School Commit Init
This commit is contained in:
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AnswerController : Controller
|
||||
{
|
||||
private readonly IAnswerRepo _answerRepo;
|
||||
public AnswerController(IAnswerRepo userRepo)
|
||||
{
|
||||
_answerRepo = userRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAll")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_answerRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "GetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Answer))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_answerRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "Add")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Answer answer)
|
||||
{
|
||||
try
|
||||
{
|
||||
_answerRepo.Add(answer);
|
||||
return CreatedAtRoute("GetById", new { id = answer.answerId }, answer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "Update")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Answer answer)
|
||||
{
|
||||
try
|
||||
{
|
||||
_answerRepo.Update(answer);
|
||||
return Ok(answer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "Delete")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_answerRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
using ProfessionalProfile.repo;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AssessmentTestController : Controller
|
||||
{
|
||||
private readonly IAssessmentTestRepo _assessmentTestRepo;
|
||||
public AssessmentTestController(IAssessmentTestRepo assessmentTestRepo)
|
||||
{
|
||||
_assessmentTestRepo = assessmentTestRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllAssessmentTests")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_assessmentTestRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "AssessmentTestGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(AssessmentTest))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_assessmentTestRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddAssessmentTest")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] AssessmentTest assessmentTest)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentTestRepo.Add(assessmentTest);
|
||||
return CreatedAtRoute("AssessmentTestGetById", new { id = assessmentTest.assessmentTestId }, assessmentTest);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateAssessmentTest")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] AssessmentTest assessmentTest)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentTestRepo.Update(assessmentTest);
|
||||
return Ok(assessmentTest);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteAssessmentTest")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentTestRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AssessmentResultController : Controller
|
||||
{
|
||||
private readonly IAssessmentResultRepo _assessmentResultRepo;
|
||||
public AssessmentResultController(IAssessmentResultRepo assessmentResultRepo)
|
||||
{
|
||||
_assessmentResultRepo = assessmentResultRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllAssessmentResults")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_assessmentResultRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "AssessmentResultGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(AssessmentResult))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_assessmentResultRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddAssessmentResult")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] AssessmentResult assessmentResult)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentResultRepo.Add(assessmentResult);
|
||||
return CreatedAtRoute("AssessmentResultGetById", new { id = assessmentResult.assesmentResultId }, assessmentResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateAssessmentResult")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] AssessmentResult assessmentResult)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentResultRepo.Update(assessmentResult);
|
||||
return Ok(assessmentResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteAssessmentResult")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_assessmentResultRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class BusinessCardController : Controller
|
||||
{
|
||||
private readonly IBusinessCardRepo _businessCardRepo;
|
||||
public BusinessCardController(IBusinessCardRepo businessCardRepo)
|
||||
{
|
||||
_businessCardRepo = businessCardRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllBusinessCards")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_businessCardRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "BusinessCardGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(BusinessCard))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_businessCardRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddBusinessCard")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] BusinessCard businessCard)
|
||||
{
|
||||
try
|
||||
{
|
||||
_businessCardRepo.Add(businessCard);
|
||||
return CreatedAtRoute("BusinessCardGetById", new { id = businessCard.bcId }, businessCard);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateBusinessCard")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] BusinessCard businessCard)
|
||||
{
|
||||
try
|
||||
{
|
||||
_businessCardRepo.Update(businessCard);
|
||||
return Ok(businessCard);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteBusinessCard")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_businessCardRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class CertificatesController : ControllerBase
|
||||
{
|
||||
private readonly ICertificateRepo _certificateRepo;
|
||||
|
||||
public CertificatesController(ICertificateRepo certificateRepo)
|
||||
{
|
||||
_certificateRepo = certificateRepo;
|
||||
}
|
||||
|
||||
// GET: api/Certificates
|
||||
[HttpGet]
|
||||
public ActionResult<IEnumerable<Certificate>> GetCertificates()
|
||||
{
|
||||
return Ok(_certificateRepo.GetAll());
|
||||
}
|
||||
|
||||
// GET: api/Certificates/5
|
||||
[HttpGet("{id}")]
|
||||
public ActionResult<Certificate> GetCertificate(int id)
|
||||
{
|
||||
var certificate = _certificateRepo.GetById(id);
|
||||
|
||||
if (certificate == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(certificate);
|
||||
}
|
||||
|
||||
// PUT: api/Certificates/5
|
||||
[HttpPut("{id}")]
|
||||
public IActionResult UpdateCertificate(int id, Certificate certificate)
|
||||
{
|
||||
if (id != certificate.certificateId)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_certificateRepo.Update(certificate);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (_certificateRepo.GetById(id) == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
// POST: api/Certificates
|
||||
[HttpPost]
|
||||
public ActionResult<Certificate> AddCertificate(Certificate certificate)
|
||||
{
|
||||
_certificateRepo.Add(certificate);
|
||||
|
||||
return CreatedAtAction("GetCertificate", new { id = certificate.certificateId }, certificate);
|
||||
}
|
||||
|
||||
// DELETE: api/Certificates/5
|
||||
[HttpDelete("{id}")]
|
||||
public IActionResult DeleteCertificate(int id)
|
||||
{
|
||||
var certificate = _certificateRepo.GetById(id);
|
||||
if (certificate == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_certificateRepo.Delete(id);
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class EducationController : Controller
|
||||
{
|
||||
private readonly IEducationRepo _educationRepo;
|
||||
public EducationController(IEducationRepo educationRepo)
|
||||
{
|
||||
_educationRepo = educationRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllEducations")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_educationRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "EducationGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Education))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_educationRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddEducation")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Education education)
|
||||
{
|
||||
try
|
||||
{
|
||||
_educationRepo.Add(education);
|
||||
return CreatedAtRoute("EducationGetById", new { id = education.educationId }, education);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateEducation")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Education education)
|
||||
{
|
||||
try
|
||||
{
|
||||
_educationRepo.Update(education);
|
||||
return Ok(education);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteEducation")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_educationRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class EndorsementController : Controller
|
||||
{
|
||||
private readonly IEndorsementRepo _endorsementRepo;
|
||||
public EndorsementController(IEndorsementRepo endorsementRepo)
|
||||
{
|
||||
_endorsementRepo = endorsementRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllEndorsements")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_endorsementRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "EndorsementGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Endorsement))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_endorsementRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddEndorsement")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Endorsement endorsement)
|
||||
{
|
||||
try
|
||||
{
|
||||
_endorsementRepo.Add(endorsement);
|
||||
return CreatedAtRoute("EndorsementGetById", new { id = endorsement.endorsementId }, endorsement);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateEndorsement")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Endorsement endorsement)
|
||||
{
|
||||
try
|
||||
{
|
||||
_endorsementRepo.Update(endorsement);
|
||||
return Ok(endorsement);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteEndorsement")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_endorsementRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class NotificationController : Controller
|
||||
{
|
||||
private readonly INotificationRepo _notificationRepo;
|
||||
public NotificationController(INotificationRepo notificationRepo)
|
||||
{
|
||||
_notificationRepo = notificationRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllNotifications")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_notificationRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "NotificationGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Notification))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_notificationRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddNotification")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Notification notification)
|
||||
{
|
||||
try
|
||||
{
|
||||
_notificationRepo.Add(notification);
|
||||
return CreatedAtRoute("NotificationGetById", new { id = notification.notificationId }, notification);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateNotification")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Notification notification)
|
||||
{
|
||||
try
|
||||
{
|
||||
_notificationRepo.Update(notification);
|
||||
return Ok(notification);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteNotification")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_notificationRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class PrivacyController : Controller
|
||||
{
|
||||
private readonly IPrivacyRepo _privacyRepo;
|
||||
public PrivacyController(IPrivacyRepo privacyRepo)
|
||||
{
|
||||
_privacyRepo = privacyRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllPrivacies")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_privacyRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "PrivacyGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Privacy))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_privacyRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddPrivacy")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Privacy privacy)
|
||||
{
|
||||
try
|
||||
{
|
||||
_privacyRepo.Add(privacy);
|
||||
return CreatedAtRoute("PrivacyGetById", new { id = privacy.Id }, privacy);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdatePrivacy")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Privacy privacy)
|
||||
{
|
||||
try
|
||||
{
|
||||
_privacyRepo.Update(privacy);
|
||||
return Ok(privacy);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeletePrivacy")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_privacyRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ProjectController : Controller
|
||||
{
|
||||
private readonly IProjectRepo _projectRepo;
|
||||
public ProjectController(IProjectRepo projectRepo)
|
||||
{
|
||||
_projectRepo = projectRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllProjects")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_projectRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "ProjectGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Project))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_projectRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddProject")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Project project)
|
||||
{
|
||||
try
|
||||
{
|
||||
_projectRepo.Add(project);
|
||||
return CreatedAtRoute("ProjectGetById", new { id = project.projectId }, project);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateProject")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Project project)
|
||||
{
|
||||
try
|
||||
{
|
||||
_projectRepo.Update(project);
|
||||
return Ok(project);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteProject")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_projectRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class QuestionController : Controller
|
||||
{
|
||||
private readonly IQuestionRepo _questionRepo;
|
||||
public QuestionController(IQuestionRepo questionRepo)
|
||||
{
|
||||
_questionRepo = questionRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllQuestions")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_questionRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "QuestionGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Question))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_questionRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddQuestion")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Question question)
|
||||
{
|
||||
try
|
||||
{
|
||||
_questionRepo.Add(question);
|
||||
return CreatedAtRoute("QuestionGetById", new { id = question.questionId }, question);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateQuestion")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Question question)
|
||||
{
|
||||
try
|
||||
{
|
||||
_questionRepo.Update(question);
|
||||
return Ok(question);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteQuestion")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_questionRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class SkillController : Controller
|
||||
{
|
||||
private readonly ISkillRepo _skillRepo;
|
||||
public SkillController(ISkillRepo skillRepo)
|
||||
{
|
||||
_skillRepo = skillRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllSkills")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_skillRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "SkillGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(User))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_skillRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddSkill")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Skill item)
|
||||
{
|
||||
try
|
||||
{
|
||||
_skillRepo.Add(item);
|
||||
return CreatedAtRoute("GetById", new { id = item.skillId }, item);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateSkill")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Skill item)
|
||||
{
|
||||
try
|
||||
{
|
||||
_skillRepo.Update(item);
|
||||
return Ok(item);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteSkill")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_skillRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("GetByUserId/{userId}", Name = "GetSkillsByUserId")]
|
||||
public IActionResult GetByUserId(int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_skillRepo.GetByUserId(userId));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("GetIdByName/{skillName}", Name = "GetIdByName")]
|
||||
public IActionResult GetIdByName(string skillName)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_skillRepo.GetIdByName(skillName));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class UserController : Controller
|
||||
{
|
||||
private readonly IUserRepoInterface _userRepo;
|
||||
public UserController(IUserRepoInterface userRepo)
|
||||
{
|
||||
_userRepo = userRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllUsers")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_userRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "UserGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(User))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_userRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddUser")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
_userRepo.Add(user);
|
||||
return CreatedAtRoute("GetById", new { id = user.userId }, user);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateUser")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
_userRepo.Update(user);
|
||||
return Ok(user);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteUser")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_userRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class VolunteeringController : Controller
|
||||
{
|
||||
private readonly IVolunteeringRepo _volunteeringRepo;
|
||||
public VolunteeringController(IVolunteeringRepo volunteeringRepo)
|
||||
{
|
||||
_volunteeringRepo = volunteeringRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllVolunteerings")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_volunteeringRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "VolunteeringGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(Volunteering))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_volunteeringRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddVolunteering")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] Volunteering volunteering)
|
||||
{
|
||||
try
|
||||
{
|
||||
_volunteeringRepo.Add(volunteering);
|
||||
return CreatedAtRoute("VolunteeringGetById", new { id = volunteering.volunteeringId }, volunteering);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateVolunteering")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] Volunteering volunteering)
|
||||
{
|
||||
try
|
||||
{
|
||||
_volunteeringRepo.Update(volunteering);
|
||||
return Ok(volunteering);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteVolunteering")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_volunteeringRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class WorkExperienceController : Controller
|
||||
{
|
||||
private readonly IWorkExperienceRepo _workExperienceRepo;
|
||||
public WorkExperienceController(IWorkExperienceRepo workExperienceRepo)
|
||||
{
|
||||
_workExperienceRepo = workExperienceRepo;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetAllWorkExperiences")]
|
||||
public IActionResult GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_workExperienceRepo.GetAll());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{id}", Name = "WorkExperienceGetById")]
|
||||
[ProducesResponseType(200, Type = typeof(WorkExperience))]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(_workExperienceRepo.GetById(id));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost(Name = "AddWorkExperience")]
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Add([FromBody] WorkExperience workExperience)
|
||||
{
|
||||
try
|
||||
{
|
||||
_workExperienceRepo.Add(workExperience);
|
||||
return CreatedAtRoute("WorkExperienceGetById", new { id = workExperience.workId }, workExperience);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut(Name = "UpdateWorkExperience")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Update([FromBody] WorkExperience workExperience)
|
||||
{
|
||||
try
|
||||
{
|
||||
_workExperienceRepo.Update(workExperience);
|
||||
return Ok(workExperience);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}", Name = "DeleteWorkExperience")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult Delete([FromRoute] int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
_workExperienceRepo.Delete(id);
|
||||
return NoContent();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.DatabaseContext
|
||||
{
|
||||
public class DataContext : DbContext
|
||||
{
|
||||
public DataContext(DbContextOptions<DataContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
public DbSet<AssessmentResult> AssessmentResult { get; set; }
|
||||
public DbSet<BusinessCard> BusinessCard { get; set; }
|
||||
public DbSet<Certificate> Certificate { get; set; }
|
||||
public DbSet<Education> Education { get; set; }
|
||||
|
||||
|
||||
public DbSet<Question> Question { get; set; }
|
||||
public DbSet<Answer> Answers { get; set; }
|
||||
public DbSet<AssessmentTest> AssessmentTest { get; set; }
|
||||
public DbSet<Privacy> Privacy { get; set; }
|
||||
public DbSet<User> User { get; set; }
|
||||
public DbSet<Skill> Skill { get; set; }
|
||||
public DbSet<Endorsement> Endorsement { get; set; }
|
||||
public DbSet<Notification> Notification { get; set; }
|
||||
|
||||
public DbSet<Project> Project { get; set; }
|
||||
|
||||
public DbSet<Volunteering> Volunteering { get; set; }
|
||||
public DbSet<WorkExperience> WorkExperience { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
||||
|
||||
modelBuilder.Entity<Endorsement>( Endorsement =>
|
||||
{
|
||||
Endorsement.HasKey(a => a.endorsementId);
|
||||
Endorsement.HasOne(a => a.Endorser)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.endorserId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
|
||||
Endorsement.HasOne(a => a.Recipient)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.recipientid)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Privacy>().HasOne(a => a.User).WithOne(a => a.Privacy).HasForeignKey<Privacy>(a => a.userId);
|
||||
modelBuilder.Entity<AssessmentTest>(AssessmentTest =>
|
||||
{
|
||||
AssessmentTest.HasKey(a => a.assessmentTestId);
|
||||
AssessmentTest.HasOne(a => a.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.userId);
|
||||
AssessmentTest.HasOne(a => a.Skill)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.skillid);
|
||||
});
|
||||
modelBuilder.Entity<Question>(Question =>
|
||||
{
|
||||
Question.HasKey(a => a.questionId);
|
||||
Question.HasOne(a => a.AssessmentTest)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.assesmentTestId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Answer>(Answer =>
|
||||
{
|
||||
Answer.HasKey(a => a.answerId);
|
||||
Answer.HasOne(a => a.Question)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.questionId);
|
||||
});
|
||||
modelBuilder.Entity<Education>(Education =>
|
||||
{
|
||||
|
||||
Education.HasKey(a => a.educationId);
|
||||
Education.HasOne(a => a.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.userId);
|
||||
});
|
||||
modelBuilder.Entity<Certificate>(Certificate =>
|
||||
{
|
||||
Certificate.HasKey(a => a.certificateId);
|
||||
Certificate.HasOne(a => a.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.userId);
|
||||
});
|
||||
modelBuilder.Entity<BusinessCard>(BussinesCard =>
|
||||
{
|
||||
BussinesCard.HasKey(a => a.bcId);
|
||||
modelBuilder.Entity<BusinessCard>()
|
||||
.HasMany(bc => bc.keySkills)
|
||||
.WithOne();
|
||||
|
||||
});
|
||||
modelBuilder.Entity<AssessmentResult>(AssessmentResult =>
|
||||
{
|
||||
AssessmentResult.HasKey(a => a.assesmentResultId);
|
||||
AssessmentResult.HasOne(a => a.AssessmentTest)
|
||||
.WithOne(a => a.AssessmentResult)
|
||||
.HasForeignKey<AssessmentResult>(a => a.assesmentTestId).OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
AssessmentResult.HasOne(a => a.User)
|
||||
.WithOne(a => a.AssessmentResult).HasForeignKey<AssessmentResult>(a => a.userId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
|
||||
});
|
||||
modelBuilder.Entity<Project>(Project =>
|
||||
{
|
||||
Project.HasKey(a => a.projectId);
|
||||
Project.HasOne(a => a.User)
|
||||
.WithOne(a => a.Project)
|
||||
.HasForeignKey<Project>(b => b.userId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Volunteering>(Volunteering =>
|
||||
{
|
||||
Volunteering.HasKey(a => a.volunteeringId);
|
||||
Volunteering.HasOne(a => a.User)
|
||||
.WithOne(a => a.Volunteering)
|
||||
.HasForeignKey<Volunteering>(a=>a.userId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WorkExperience>(WorkExperience =>
|
||||
{
|
||||
WorkExperience.HasKey(a => a.workId);
|
||||
WorkExperience.HasOne(a => a.User)
|
||||
.WithOne(a => a.WorkExperience)
|
||||
.HasForeignKey<WorkExperience>(a => a.userId);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Repo;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IAnswerRepo
|
||||
{
|
||||
public Answer GetById(int id);
|
||||
public ICollection<Answer> GetAll();
|
||||
public void Add(Answer item);
|
||||
public void Update(Answer item);
|
||||
public void Delete(int id);
|
||||
ICollection<Answer> GetAnswers(int questionId);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IAssessmentResultRepo
|
||||
{
|
||||
public AssessmentResult GetById(int id);
|
||||
public ICollection<AssessmentResult> GetAll();
|
||||
public void Add(AssessmentResult item);
|
||||
public void Update(AssessmentResult item);
|
||||
public void Delete(int id);
|
||||
public ICollection<AssessmentResult> GetAssessmentResultsByUserId(int userId);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IAssessmentTestRepo
|
||||
{
|
||||
public AssessmentTest GetById(int id);
|
||||
public ICollection<AssessmentTest> GetAll();
|
||||
public void Add(AssessmentTest item);
|
||||
public void Update(AssessmentTest item);
|
||||
public void Delete(int id);
|
||||
public int GetIdByName(string testName);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IBusinessCardRepo
|
||||
{
|
||||
public BusinessCard GetById(int id);
|
||||
public ICollection<BusinessCard> GetAll();
|
||||
public void Add(BusinessCard item);
|
||||
public void Update(BusinessCard item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface ICertificateRepo
|
||||
{
|
||||
public Certificate GetById(int id);
|
||||
public ICollection<Certificate> GetAll();
|
||||
public void Add(Certificate item);
|
||||
public void Update(Certificate item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IEducationRepo
|
||||
{
|
||||
public Education GetById(int id);
|
||||
public ICollection<Education> GetAll();
|
||||
public void Add(Education item);
|
||||
public void Update(Education item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IEndorsementRepo
|
||||
{
|
||||
public Endorsement GetById(int id);
|
||||
public ICollection<Endorsement> GetAll();
|
||||
public void Add(Endorsement item);
|
||||
public void Update(Endorsement item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface INotificationRepo
|
||||
{
|
||||
public Notification GetById(int id);
|
||||
public ICollection<Notification> GetAll();
|
||||
public void Add(Notification item);
|
||||
public void Update(Notification item);
|
||||
public void Delete(int id);
|
||||
public List<Notification> GetAllByUserId(int userId);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IPrivacyRepo
|
||||
{
|
||||
public Privacy GetById(int id);
|
||||
public ICollection<Privacy> GetAll();
|
||||
public void Add(Privacy item);
|
||||
public void Update(Privacy item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IProjectRepo
|
||||
{
|
||||
public Project GetById(int id);
|
||||
public ICollection<Project> GetAll();
|
||||
public void Add(Project item);
|
||||
public void Update(Project item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IQuestionRepo
|
||||
{
|
||||
public Question GetById(int id);
|
||||
public ICollection<Question> GetAll();
|
||||
public void Add(Question item);
|
||||
public void Update(Question item);
|
||||
public void Delete(int id);
|
||||
public int GetIdByNameAndAssessmentId(string questionName, int assessmentId);
|
||||
public List<Question> GetAllByTestId(int testId);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface ISkillRepo
|
||||
{
|
||||
public Skill GetById(int id);
|
||||
public ICollection<Skill> GetAll();
|
||||
public void Add(Skill item);
|
||||
public void Update(Skill item);
|
||||
public void Delete(int id);
|
||||
public List<Skill> GetByUserId(int userId);
|
||||
public int GetIdByName(string name);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IUserRepoInterface
|
||||
{
|
||||
public User GetById(int id);
|
||||
public ICollection<User> GetAll();
|
||||
public void Add(User item);
|
||||
public void Update(User item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IVolunteeringRepo
|
||||
{
|
||||
public Volunteering GetById(int id);
|
||||
public ICollection<Volunteering> GetAll();
|
||||
public void Add(Volunteering item);
|
||||
public void Update(Volunteering item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using ProfessionalProfile.Domain;
|
||||
|
||||
namespace ProfessionalProfile.Interfaces
|
||||
{
|
||||
public interface IWorkExperienceRepo
|
||||
{
|
||||
public WorkExperience GetById(int id);
|
||||
public ICollection<WorkExperience> GetAll();
|
||||
public void Add(WorkExperience item);
|
||||
public void Update(WorkExperience item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Repo
|
||||
{
|
||||
public interface IRepoInterface<T>
|
||||
{
|
||||
public T GetById(int id);
|
||||
public ICollection<T> GetAll();
|
||||
public void Add(T item);
|
||||
public void Update(T item);
|
||||
public void Delete(int id);
|
||||
}
|
||||
}
|
||||
+728
@@ -0,0 +1,728 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ProfessionalProfile.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20240514164956_UwU")]
|
||||
partial class UwU
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Answer", b =>
|
||||
{
|
||||
b.Property<int>("answerId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("answerId"));
|
||||
|
||||
b.Property<string>("answerText")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("isCorrect")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("questionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("answerId");
|
||||
|
||||
b.HasIndex("questionId");
|
||||
|
||||
b.ToTable("Answers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentResult", b =>
|
||||
{
|
||||
b.Property<int>("assesmentResultId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("assesmentResultId"));
|
||||
|
||||
b.Property<int>("assesmentTestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("score")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("testDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("assesmentResultId");
|
||||
|
||||
b.HasIndex("assesmentTestId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AssessmentResult");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.Property<int>("assessmentTestId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("assessmentTestId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("skillid")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("testName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("assessmentTestId");
|
||||
|
||||
b.HasIndex("skillid");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("AssessmentTest");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.Property<int>("bcId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("bcId"));
|
||||
|
||||
b.Property<string>("summary")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("uniqueUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("bcId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("BusinessCard");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Certificate", b =>
|
||||
{
|
||||
b.Property<int>("certificateId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("certificateId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("expirationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("issuedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("issuedDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("certificateId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Certificate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Education", b =>
|
||||
{
|
||||
b.Property<int>("educationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("educationId"));
|
||||
|
||||
b.Property<string>("degree")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("fieldOfStudy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("graduationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("institution")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("educationId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Education");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Endorsement", b =>
|
||||
{
|
||||
b.Property<int>("endorsementId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("endorsementId"));
|
||||
|
||||
b.Property<int>("endorserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("recipientid")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("skillId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("endorsementId");
|
||||
|
||||
b.HasIndex("endorserId");
|
||||
|
||||
b.HasIndex("recipientid");
|
||||
|
||||
b.HasIndex("skillId");
|
||||
|
||||
b.ToTable("Endorsement");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Notification", b =>
|
||||
{
|
||||
b.Property<int>("notificationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("notificationId"));
|
||||
|
||||
b.Property<string>("activity")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("details")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("isRead")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("timestamp")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("notificationId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Notification");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Privacy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("CanViewCertificates")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewEducation")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewProjects")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewSkills")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewVolunteering")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewWorkExperience")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Privacy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Project", b =>
|
||||
{
|
||||
b.Property<int>("projectId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("projectId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("projectName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("technologies")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("projectId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Project");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Question", b =>
|
||||
{
|
||||
b.Property<int>("questionId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("questionId"));
|
||||
|
||||
b.Property<int>("assesmentTestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("questionText")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("questionId");
|
||||
|
||||
b.HasIndex("assesmentTestId");
|
||||
|
||||
b.ToTable("Question");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.Property<int>("skillId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("skillId"));
|
||||
|
||||
b.Property<int?>("BusinessCardbcId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("skillId");
|
||||
|
||||
b.HasIndex("BusinessCardbcId");
|
||||
|
||||
b.ToTable("Skill");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.User", b =>
|
||||
{
|
||||
b.Property<int>("userId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("userId"));
|
||||
|
||||
b.Property<string>("address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("darkTheme")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("dateOfBirth")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("firstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("lastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("picture")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("summary")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("websiteURL")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("userId");
|
||||
|
||||
b.ToTable("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Volunteering", b =>
|
||||
{
|
||||
b.Property<int>("volunteeringId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("volunteeringId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("organisation")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("role")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("volunteeringId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Volunteering");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.WorkExperience", b =>
|
||||
{
|
||||
b.Property<int>("workId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("workId"));
|
||||
|
||||
b.Property<string>("achievements")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("company")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("employmentPeriod")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("jobTitle")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("location")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("workId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("WorkExperience");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Answer", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.Question", "Question")
|
||||
.WithMany()
|
||||
.HasForeignKey("questionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Question");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentResult", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.AssessmentTest", "AssessmentTest")
|
||||
.WithOne("AssessmentResult")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.AssessmentResult", "assesmentTestId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("AssessmentResult")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.AssessmentResult", "userId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AssessmentTest");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.Skill", "Skill")
|
||||
.WithMany()
|
||||
.HasForeignKey("skillid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Skill");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Certificate", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Education", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Endorsement", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "Endorser")
|
||||
.WithMany()
|
||||
.HasForeignKey("endorserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "Recipient")
|
||||
.WithMany()
|
||||
.HasForeignKey("recipientid")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.Skill", null)
|
||||
.WithMany("endorsements")
|
||||
.HasForeignKey("skillId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Endorser");
|
||||
|
||||
b.Navigation("Recipient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Notification", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany("Notifications")
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Privacy", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Privacy")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Privacy", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Project", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Project")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Project", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Question", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.AssessmentTest", "AssessmentTest")
|
||||
.WithMany()
|
||||
.HasForeignKey("assesmentTestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AssessmentTest");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.BusinessCard", null)
|
||||
.WithMany("keySkills")
|
||||
.HasForeignKey("BusinessCardbcId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Volunteering", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Volunteering")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Volunteering", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.WorkExperience", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("WorkExperience")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.WorkExperience", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.Navigation("AssessmentResult")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.Navigation("keySkills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.Navigation("endorsements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.User", b =>
|
||||
{
|
||||
b.Navigation("AssessmentResult");
|
||||
|
||||
b.Navigation("Notifications");
|
||||
|
||||
b.Navigation("Privacy");
|
||||
|
||||
b.Navigation("Project");
|
||||
|
||||
b.Navigation("Volunteering");
|
||||
|
||||
b.Navigation("WorkExperience");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+516
@@ -0,0 +1,516 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ProfessionalProfile.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UwU : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "User",
|
||||
columns: table => new
|
||||
{
|
||||
userId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
firstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
lastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
summary = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
dateOfBirth = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
darkTheme = table.Column<bool>(type: "bit", nullable: false),
|
||||
address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
websiteURL = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
picture = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_User", x => x.userId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BusinessCard",
|
||||
columns: table => new
|
||||
{
|
||||
bcId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
summary = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
uniqueUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BusinessCard", x => x.bcId);
|
||||
table.ForeignKey(
|
||||
name: "FK_BusinessCard_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Certificate",
|
||||
columns: table => new
|
||||
{
|
||||
certificateId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
issuedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
issuedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
expirationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
userId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Certificate", x => x.certificateId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Certificate_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Education",
|
||||
columns: table => new
|
||||
{
|
||||
educationId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
degree = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
institution = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
fieldOfStudy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
graduationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Education", x => x.educationId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Education_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Notification",
|
||||
columns: table => new
|
||||
{
|
||||
notificationId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
activity = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
timestamp = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
details = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
isRead = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Notification", x => x.notificationId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Notification_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Privacy",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
CanViewEducation = table.Column<bool>(type: "bit", nullable: false),
|
||||
CanViewWorkExperience = table.Column<bool>(type: "bit", nullable: false),
|
||||
CanViewSkills = table.Column<bool>(type: "bit", nullable: false),
|
||||
CanViewProjects = table.Column<bool>(type: "bit", nullable: false),
|
||||
CanViewCertificates = table.Column<bool>(type: "bit", nullable: false),
|
||||
CanViewVolunteering = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Privacy", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Privacy_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Project",
|
||||
columns: table => new
|
||||
{
|
||||
projectId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
projectName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
technologies = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
userId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Project", x => x.projectId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Project_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Volunteering",
|
||||
columns: table => new
|
||||
{
|
||||
volunteeringId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
organisation = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
role = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
description = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Volunteering", x => x.volunteeringId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Volunteering_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkExperience",
|
||||
columns: table => new
|
||||
{
|
||||
workId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
jobTitle = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
company = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
location = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
employmentPeriod = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
responsibilities = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
achievements = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
description = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorkExperience", x => x.workId);
|
||||
table.ForeignKey(
|
||||
name: "FK_WorkExperience_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Skill",
|
||||
columns: table => new
|
||||
{
|
||||
skillId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
BusinessCardbcId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Skill", x => x.skillId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Skill_BusinessCard_BusinessCardbcId",
|
||||
column: x => x.BusinessCardbcId,
|
||||
principalTable: "BusinessCard",
|
||||
principalColumn: "bcId");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AssessmentTest",
|
||||
columns: table => new
|
||||
{
|
||||
assessmentTestId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
testName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
skillid = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AssessmentTest", x => x.assessmentTestId);
|
||||
table.ForeignKey(
|
||||
name: "FK_AssessmentTest_Skill_skillid",
|
||||
column: x => x.skillid,
|
||||
principalTable: "Skill",
|
||||
principalColumn: "skillId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AssessmentTest_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Endorsement",
|
||||
columns: table => new
|
||||
{
|
||||
endorsementId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
endorserId = table.Column<int>(type: "int", nullable: false),
|
||||
recipientid = table.Column<int>(type: "int", nullable: false),
|
||||
skillId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Endorsement", x => x.endorsementId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Endorsement_Skill_skillId",
|
||||
column: x => x.skillId,
|
||||
principalTable: "Skill",
|
||||
principalColumn: "skillId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Endorsement_User_endorserId",
|
||||
column: x => x.endorserId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Endorsement_User_recipientid",
|
||||
column: x => x.recipientid,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AssessmentResult",
|
||||
columns: table => new
|
||||
{
|
||||
assesmentResultId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
assesmentTestId = table.Column<int>(type: "int", nullable: false),
|
||||
score = table.Column<int>(type: "int", nullable: false),
|
||||
userId = table.Column<int>(type: "int", nullable: false),
|
||||
testDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AssessmentResult", x => x.assesmentResultId);
|
||||
table.ForeignKey(
|
||||
name: "FK_AssessmentResult_AssessmentTest_assesmentTestId",
|
||||
column: x => x.assesmentTestId,
|
||||
principalTable: "AssessmentTest",
|
||||
principalColumn: "assessmentTestId");
|
||||
table.ForeignKey(
|
||||
name: "FK_AssessmentResult_User_userId",
|
||||
column: x => x.userId,
|
||||
principalTable: "User",
|
||||
principalColumn: "userId");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Question",
|
||||
columns: table => new
|
||||
{
|
||||
questionId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
questionText = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
assesmentTestId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Question", x => x.questionId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Question_AssessmentTest_assesmentTestId",
|
||||
column: x => x.assesmentTestId,
|
||||
principalTable: "AssessmentTest",
|
||||
principalColumn: "assessmentTestId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Answers",
|
||||
columns: table => new
|
||||
{
|
||||
answerId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
answerText = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
questionId = table.Column<int>(type: "int", nullable: false),
|
||||
isCorrect = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Answers", x => x.answerId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Answers_Question_questionId",
|
||||
column: x => x.questionId,
|
||||
principalTable: "Question",
|
||||
principalColumn: "questionId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Answers_questionId",
|
||||
table: "Answers",
|
||||
column: "questionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AssessmentResult_assesmentTestId",
|
||||
table: "AssessmentResult",
|
||||
column: "assesmentTestId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AssessmentResult_userId",
|
||||
table: "AssessmentResult",
|
||||
column: "userId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AssessmentTest_skillid",
|
||||
table: "AssessmentTest",
|
||||
column: "skillid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AssessmentTest_userId",
|
||||
table: "AssessmentTest",
|
||||
column: "userId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BusinessCard_userId",
|
||||
table: "BusinessCard",
|
||||
column: "userId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Certificate_userId",
|
||||
table: "Certificate",
|
||||
column: "userId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Education_userId",
|
||||
table: "Education",
|
||||
column: "userId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Endorsement_endorserId",
|
||||
table: "Endorsement",
|
||||
column: "endorserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Endorsement_recipientid",
|
||||
table: "Endorsement",
|
||||
column: "recipientid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Endorsement_skillId",
|
||||
table: "Endorsement",
|
||||
column: "skillId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Notification_userId",
|
||||
table: "Notification",
|
||||
column: "userId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Privacy_userId",
|
||||
table: "Privacy",
|
||||
column: "userId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Project_userId",
|
||||
table: "Project",
|
||||
column: "userId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Question_assesmentTestId",
|
||||
table: "Question",
|
||||
column: "assesmentTestId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Skill_BusinessCardbcId",
|
||||
table: "Skill",
|
||||
column: "BusinessCardbcId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Volunteering_userId",
|
||||
table: "Volunteering",
|
||||
column: "userId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkExperience_userId",
|
||||
table: "WorkExperience",
|
||||
column: "userId",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Answers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AssessmentResult");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Certificate");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Education");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Endorsement");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Notification");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Privacy");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Project");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Volunteering");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkExperience");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Question");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AssessmentTest");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Skill");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BusinessCard");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "User");
|
||||
}
|
||||
}
|
||||
}
|
||||
+725
@@ -0,0 +1,725 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ProfessionalProfile.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
partial class DataContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Answer", b =>
|
||||
{
|
||||
b.Property<int>("answerId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("answerId"));
|
||||
|
||||
b.Property<string>("answerText")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("isCorrect")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("questionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("answerId");
|
||||
|
||||
b.HasIndex("questionId");
|
||||
|
||||
b.ToTable("Answers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentResult", b =>
|
||||
{
|
||||
b.Property<int>("assesmentResultId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("assesmentResultId"));
|
||||
|
||||
b.Property<int>("assesmentTestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("score")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("testDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("assesmentResultId");
|
||||
|
||||
b.HasIndex("assesmentTestId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AssessmentResult");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.Property<int>("assessmentTestId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("assessmentTestId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("skillid")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("testName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("assessmentTestId");
|
||||
|
||||
b.HasIndex("skillid");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("AssessmentTest");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.Property<int>("bcId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("bcId"));
|
||||
|
||||
b.Property<string>("summary")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("uniqueUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("bcId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("BusinessCard");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Certificate", b =>
|
||||
{
|
||||
b.Property<int>("certificateId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("certificateId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("expirationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("issuedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("issuedDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("certificateId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Certificate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Education", b =>
|
||||
{
|
||||
b.Property<int>("educationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("educationId"));
|
||||
|
||||
b.Property<string>("degree")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("fieldOfStudy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("graduationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("institution")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("educationId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Education");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Endorsement", b =>
|
||||
{
|
||||
b.Property<int>("endorsementId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("endorsementId"));
|
||||
|
||||
b.Property<int>("endorserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("recipientid")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("skillId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("endorsementId");
|
||||
|
||||
b.HasIndex("endorserId");
|
||||
|
||||
b.HasIndex("recipientid");
|
||||
|
||||
b.HasIndex("skillId");
|
||||
|
||||
b.ToTable("Endorsement");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Notification", b =>
|
||||
{
|
||||
b.Property<int>("notificationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("notificationId"));
|
||||
|
||||
b.Property<string>("activity")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("details")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("isRead")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("timestamp")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("notificationId");
|
||||
|
||||
b.HasIndex("userId");
|
||||
|
||||
b.ToTable("Notification");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Privacy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("CanViewCertificates")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewEducation")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewProjects")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewSkills")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewVolunteering")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanViewWorkExperience")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Privacy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Project", b =>
|
||||
{
|
||||
b.Property<int>("projectId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("projectId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("projectName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("technologies")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("projectId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Project");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Question", b =>
|
||||
{
|
||||
b.Property<int>("questionId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("questionId"));
|
||||
|
||||
b.Property<int>("assesmentTestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("questionText")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("questionId");
|
||||
|
||||
b.HasIndex("assesmentTestId");
|
||||
|
||||
b.ToTable("Question");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.Property<int>("skillId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("skillId"));
|
||||
|
||||
b.Property<int?>("BusinessCardbcId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("skillId");
|
||||
|
||||
b.HasIndex("BusinessCardbcId");
|
||||
|
||||
b.ToTable("Skill");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.User", b =>
|
||||
{
|
||||
b.Property<int>("userId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("userId"));
|
||||
|
||||
b.Property<string>("address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("darkTheme")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("dateOfBirth")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("firstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("lastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("picture")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("summary")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("websiteURL")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("userId");
|
||||
|
||||
b.ToTable("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Volunteering", b =>
|
||||
{
|
||||
b.Property<int>("volunteeringId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("volunteeringId"));
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("organisation")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("role")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("volunteeringId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Volunteering");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.WorkExperience", b =>
|
||||
{
|
||||
b.Property<int>("workId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("workId"));
|
||||
|
||||
b.Property<string>("achievements")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("company")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("employmentPeriod")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("jobTitle")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("location")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("userId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("workId");
|
||||
|
||||
b.HasIndex("userId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("WorkExperience");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Answer", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.Question", "Question")
|
||||
.WithMany()
|
||||
.HasForeignKey("questionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Question");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentResult", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.AssessmentTest", "AssessmentTest")
|
||||
.WithOne("AssessmentResult")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.AssessmentResult", "assesmentTestId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("AssessmentResult")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.AssessmentResult", "userId")
|
||||
.OnDelete(DeleteBehavior.NoAction)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AssessmentTest");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.Skill", "Skill")
|
||||
.WithMany()
|
||||
.HasForeignKey("skillid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Skill");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Certificate", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Education", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Endorsement", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "Endorser")
|
||||
.WithMany()
|
||||
.HasForeignKey("endorserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "Recipient")
|
||||
.WithMany()
|
||||
.HasForeignKey("recipientid")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ProfessionalProfile.Domain.Skill", null)
|
||||
.WithMany("endorsements")
|
||||
.HasForeignKey("skillId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Endorser");
|
||||
|
||||
b.Navigation("Recipient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Notification", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithMany("Notifications")
|
||||
.HasForeignKey("userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Privacy", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Privacy")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Privacy", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Project", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Project")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Project", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Question", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.AssessmentTest", "AssessmentTest")
|
||||
.WithMany()
|
||||
.HasForeignKey("assesmentTestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AssessmentTest");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.BusinessCard", null)
|
||||
.WithMany("keySkills")
|
||||
.HasForeignKey("BusinessCardbcId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Volunteering", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("Volunteering")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.Volunteering", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.WorkExperience", b =>
|
||||
{
|
||||
b.HasOne("ProfessionalProfile.Domain.User", "User")
|
||||
.WithOne("WorkExperience")
|
||||
.HasForeignKey("ProfessionalProfile.Domain.WorkExperience", "userId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.AssessmentTest", b =>
|
||||
{
|
||||
b.Navigation("AssessmentResult")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.BusinessCard", b =>
|
||||
{
|
||||
b.Navigation("keySkills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.Skill", b =>
|
||||
{
|
||||
b.Navigation("endorsements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ProfessionalProfile.Domain.User", b =>
|
||||
{
|
||||
b.Navigation("AssessmentResult");
|
||||
|
||||
b.Navigation("Notifications");
|
||||
|
||||
b.Navigation("Privacy");
|
||||
|
||||
b.Navigation("Project");
|
||||
|
||||
b.Navigation("Volunteering");
|
||||
|
||||
b.Navigation("WorkExperience");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="Views\Shared\_ValidationScriptsPartial.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Views\Skills\Create.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Views\Skills\Delete.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Views\Skills\Details.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Views\Skills\Edit.cshtml" />
|
||||
<_ContentIncludedByDefault Remove="Views\Skills\Index.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers-District3\" />
|
||||
<Folder Include="DataBaseContext-District3\" />
|
||||
<Folder Include="domain-District3\" />
|
||||
<Folder Include="RepoInterface-District3\" />
|
||||
<Folder Include="Repos-District3\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>https</ActiveDebugProfile>
|
||||
<Controller_SelectedScaffolderID>MvcControllerWithContextScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
|
||||
<WebStackScaffolding_ControllerDialogWidth>650</WebStackScaffolding_ControllerDialogWidth>
|
||||
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
|
||||
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
|
||||
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
|
||||
<WebStackScaffolding_LayoutPageFile />
|
||||
<WebStackScaffolding_DbContextTypeFullName>ProfessionalProfile.DatabaseContext.DataContext</WebStackScaffolding_DbContextTypeFullName>
|
||||
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
|
||||
<WebStackScaffolding_IsViewGenerationSelected>True</WebStackScaffolding_IsViewGenerationSelected>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
@ProfessionalProfile_HostAddress = http://localhost:5148
|
||||
|
||||
GET {{ProfessionalProfile_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
using ProfessionalProfile.repo;
|
||||
using ProfessionalProfile.Repo;
|
||||
|
||||
|
||||
namespace ProfessionalProfile
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddDbContextFactory<DataContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"));
|
||||
|
||||
});
|
||||
builder.Services.AddSingleton<IAnswerRepo, AnswerRepo>();
|
||||
builder.Services.AddSingleton<IAssessmentResultRepo, AssessmentResultRepo>();
|
||||
builder.Services.AddSingleton<IAssessmentTestRepo, AssessmentTestRepo>();
|
||||
builder.Services.AddSingleton<IBusinessCardRepo, BusinessCardRepo>();
|
||||
builder.Services.AddSingleton<ICertificateRepo, CertificateRepo>();
|
||||
builder.Services.AddSingleton<IEducationRepo, EducationRepo>();
|
||||
builder.Services.AddSingleton<IEndorsementRepo, EndorsementRepo>();
|
||||
builder.Services.AddSingleton<INotificationRepo, NotificationRepo>();
|
||||
builder.Services.AddSingleton<IPrivacyRepo, PrivacyRepo>();
|
||||
builder.Services.AddSingleton<IProjectRepo, ProjectRepo>();
|
||||
builder.Services.AddSingleton<IQuestionRepo, QuestionRepo>();
|
||||
builder.Services.AddSingleton<ISkillRepo, SkillRepo>();
|
||||
builder.Services.AddSingleton<IUserRepoInterface, UserRepo>();
|
||||
builder.Services.AddSingleton<IVolunteeringRepo, VolunteeringRepo>();
|
||||
builder.Services.AddSingleton<IWorkExperienceRepo, WorkExperienceRepo>();
|
||||
|
||||
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:2832",
|
||||
"sslPort": 44306
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5148",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7241;http://localhost:5148",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace ProfessionalProfile
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Data Source =DESKTOP-IO9FIG6\\SQLEXPRESS; Initial Catalog = UwU; Integrated Security = true; Connect Timeout=30;Encrypt=True;Trust Server Certificate=True;Application Intent=ReadWrite;Multi Subnet Failover=False"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Answer
|
||||
{
|
||||
public int answerId { get; set; }
|
||||
public string answerText { get; set; }
|
||||
public int questionId { get; set; }
|
||||
public bool isCorrect { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual Question? Question { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class AnswerDTO
|
||||
{
|
||||
public string AnswerText { get; set; }
|
||||
public bool IsCorrect { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class AssessmentResult
|
||||
{
|
||||
public int assesmentResultId { get; set; }
|
||||
public int assesmentTestId { get; set; }
|
||||
public int score { get; set; }
|
||||
public int userId { get; set; }
|
||||
public DateTime testDate { get; set; }
|
||||
|
||||
//Navigation properties
|
||||
[JsonIgnore]
|
||||
public AssessmentTest ?AssessmentTest { get; set; }
|
||||
[JsonIgnore]
|
||||
|
||||
public User ?User { get; set; }
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class AssessmentTest
|
||||
{
|
||||
public int assessmentTestId { get; set;}
|
||||
public string testName { get; set; }
|
||||
public int userId { get; set; }
|
||||
public string description { get; set; }
|
||||
public int skillid { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual User ?User { get; set; }
|
||||
[JsonIgnore]
|
||||
|
||||
public virtual Skill ?Skill { get; set; }
|
||||
[JsonIgnore]
|
||||
|
||||
public virtual AssessmentResult ?AssessmentResult { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class AssessmentTestDTO
|
||||
{
|
||||
public string TestName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<QuestionDTO> Questions { get; set; }
|
||||
public string SkillTested { get; set; }
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class BusinessCard
|
||||
{
|
||||
public int bcId { get; set;}
|
||||
public int userId { get; set; }
|
||||
public string summary { get; set; }
|
||||
public string uniqueUrl { get; set; }
|
||||
|
||||
//Navigation properties
|
||||
[JsonIgnore]
|
||||
public User ?User { get; set; }
|
||||
[JsonIgnore]
|
||||
public ICollection<Skill> ?keySkills { get; set; }
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Certificate
|
||||
{
|
||||
public int certificateId { get; set; }
|
||||
public string name { get; set; }
|
||||
public string issuedBy { get; set; }
|
||||
public string description { get; set; }
|
||||
public DateTime issuedDate { get; set; }
|
||||
public DateTime expirationDate { get; set; }
|
||||
public int userId { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual User? User { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Education
|
||||
{
|
||||
public int educationId { get; set;}
|
||||
public int userId { get; set; }
|
||||
public string degree { get; set; }
|
||||
public string institution { get; set; }
|
||||
public string fieldOfStudy { get; set; }
|
||||
public DateTime graduationDate { get; set; }
|
||||
public double gPA;
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual User ?User { get; set; }
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Endorsement
|
||||
{
|
||||
|
||||
public int endorsementId { get; set; }
|
||||
public int endorserId { get; set; }
|
||||
public int recipientid { get; set; }
|
||||
public int skillId { get; set; }
|
||||
|
||||
//navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual User? Endorser { get; set; }
|
||||
[JsonIgnore]
|
||||
public virtual User? Recipient { get; set; }
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Notification
|
||||
{
|
||||
[Key]
|
||||
public int notificationId { get; set;}
|
||||
public int userId { get; set; }
|
||||
public string activity { get; set; }
|
||||
public DateTime timestamp { get; set; }
|
||||
public string details { get; set; }
|
||||
public bool isRead { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Privacy
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public int userId { get; set; }
|
||||
public bool CanViewEducation { get; set; }
|
||||
public bool CanViewWorkExperience { get; set; }
|
||||
public bool CanViewSkills { get; set; }
|
||||
public bool CanViewProjects { get; set; }
|
||||
public bool CanViewCertificates { get; set; }
|
||||
public bool CanViewVolunteering { get; set; }
|
||||
|
||||
//navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual User? User { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Project
|
||||
{
|
||||
public int projectId { get; set;}
|
||||
public string projectName { get; set; }
|
||||
public string description { get; set; }
|
||||
public string technologies { get; set; }
|
||||
public int userId { get; set; }
|
||||
|
||||
//Navigation properties
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Question
|
||||
{
|
||||
public int questionId { get; set; }
|
||||
public string questionText { get; set; }
|
||||
public int assesmentTestId { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
[JsonIgnore]
|
||||
public virtual AssessmentTest ?AssessmentTest { get; set; }
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class QuestionDTO
|
||||
{
|
||||
public string QuestionText { get; set; }
|
||||
public List<AnswerDTO> Answers { get; set; }
|
||||
public AnswerDTO CorrectAnswer { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Skill
|
||||
{
|
||||
public int skillId { get; set;}
|
||||
public string name { get; set; }
|
||||
|
||||
|
||||
//navigation property
|
||||
[JsonIgnore]
|
||||
public ICollection<Endorsement>? endorsements { get; set;}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public int userId { get; set; }
|
||||
public string firstName { get; set; }
|
||||
public string lastName { get; set; }
|
||||
public string email { get; set; }
|
||||
public string password { get; set; }
|
||||
public string phone { get; set; }
|
||||
public string summary { get; set; }
|
||||
public DateTime dateOfBirth { get; set; }
|
||||
public bool darkTheme { get; set; }
|
||||
public string address { get; set; }
|
||||
public string websiteURL { get; set; }
|
||||
public string picture { get; set; }
|
||||
|
||||
// Navigation property for one-to-one relationship
|
||||
[JsonIgnore]
|
||||
public Privacy? Privacy { get; set; }
|
||||
[JsonIgnore]
|
||||
public ICollection<Notification>? Notifications { get; set; }
|
||||
[JsonIgnore]
|
||||
public AssessmentResult? AssessmentResult { get; set; }
|
||||
[JsonIgnore]
|
||||
public Project? Project { get; set; }
|
||||
[JsonIgnore]
|
||||
public Volunteering? Volunteering { get; set; }
|
||||
[JsonIgnore]
|
||||
public WorkExperience? WorkExperience { get; set; }
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class Volunteering
|
||||
{
|
||||
public int volunteeringId { get; set; }
|
||||
public int userId { get; set; }
|
||||
public string organisation { get; set; }
|
||||
public string role { get; set; }
|
||||
public string description { get; set; }
|
||||
|
||||
//Navigation properties
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProfessionalProfile.Domain
|
||||
{
|
||||
public class WorkExperience
|
||||
{
|
||||
public int workId { get; set; }
|
||||
public int userId { get; set; }
|
||||
public string jobTitle { get; set; }
|
||||
public string company { get; set; }
|
||||
public string location { get; set; }
|
||||
public string employmentPeriod { get; set; }
|
||||
public string responsibilities { get; set; }
|
||||
public string achievements { get; set; }
|
||||
public string description { get; set; }
|
||||
|
||||
//Navigation properties
|
||||
[JsonIgnore]
|
||||
public User? User { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class AnswerRepo : IAnswerRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public AnswerRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(Answer item)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Answers.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var answer = context.Answers.Find(id);
|
||||
context.Answers.Remove(answer);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Answer> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Answers.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public Answer GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Answers.Find(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Answer answer)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Answers.Update(answer);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Answer> GetAnswers(int QuestionId)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Answers.Where(x => x.questionId == QuestionId).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class AssessmentResultRepo : IAssessmentResultRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
|
||||
public AssessmentResultRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(AssessmentResult item)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.AssessmentResult.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var assessmentResult = context.AssessmentResult.Find(id);
|
||||
context.AssessmentResult.Remove(assessmentResult);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<AssessmentResult> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentResult.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public AssessmentResult GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentResult.Find(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(AssessmentResult assessmentResult)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.AssessmentResult.Update(assessmentResult);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<AssessmentResult> GetAssessmentResultsByUserId(int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentResult.Where(x => x.userId == userId).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class AssessmentTestRepo : IAssessmentTestRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public AssessmentTestRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(AssessmentTest item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.AssessmentTest.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var assessmentTest = context.AssessmentTest.Find(id);
|
||||
context.AssessmentTest.Remove(assessmentTest);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<AssessmentTest> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentTest.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public AssessmentTest GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentTest.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(AssessmentTest assessmentTest)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.AssessmentTest.Update(assessmentTest);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
public int GetIdByName(string testName)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.AssessmentTest.Where(x => x.testName == testName).Select(x => x.assessmentTestId).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class BusinessCardRepo : IBusinessCardRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public BusinessCardRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(BusinessCard item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.BusinessCard.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var businessCard = context.BusinessCard.Find(id);
|
||||
context.BusinessCard.Remove(businessCard);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<BusinessCard> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.BusinessCard.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public BusinessCard GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.BusinessCard.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(BusinessCard businessCard)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.BusinessCard.Update(businessCard);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class CertificateRepo : ICertificateRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
|
||||
public CertificateRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
|
||||
public void Add(Certificate item)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Certificate.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var certificate = context.Certificate.Find(id);
|
||||
context.Certificate.Remove(certificate);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Certificate> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Certificate.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public Certificate GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Certificate.Find(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Certificate certificate)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Certificate.Update(certificate);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class EducationRepo : IEducationRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public EducationRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(Education item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Education.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var education = context.Education.Find(id);
|
||||
context.Education.Remove(education);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Education> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Education.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public Education GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Education.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Education education)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Education.Update(education);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class EndorsementRepo : IEndorsementRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public EndorsementRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(Endorsement item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Endorsement.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var endorsement = context.Endorsement.Find(id);
|
||||
context.Endorsement.Remove(endorsement);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Endorsement> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Endorsement.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public Endorsement GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Endorsement.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Endorsement endorsement)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Endorsement.Update(endorsement);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class NotificationRepo : INotificationRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public NotificationRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(Notification item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Notification.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var notification = context.Notification.Find(id);
|
||||
context.Notification.Remove(notification);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Notification> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Notification.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public Notification GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Notification.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Notification notification)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Notification.Update(notification);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
// List<Notification> ProfessionalProfile.Interfaces.INotificationRepo.GetAllByUserId(int)' is not implemented
|
||||
public List<Notification> GetAllByUserId(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Notification.Where(n => n.userId == id).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class PrivacyRepo : IPrivacyRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public PrivacyRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(Privacy item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Privacy.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var privacy = context.Privacy.Find(id);
|
||||
context.Privacy.Remove(privacy);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Privacy> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Privacy.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public Privacy GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Privacy.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Privacy privacy)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Privacy.Update(privacy);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class ProjectRepo : IProjectRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public ProjectRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(Project item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Project.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var project = context.Project.Find(id);
|
||||
context.Project.Remove(project);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Project> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Project.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public Project GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Project.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Project project)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Project.Update(project);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class QuestionRepo : IQuestionRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public QuestionRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(Question item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Question.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var question = context.Question.Find(id);
|
||||
context.Question.Remove(question);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Question> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Question.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public Question GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Question.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Question question)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Question.Update(question);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
//Interface member 'List<Question> ProfessionalProfile.Interfaces.IQuestionRepo.GetAllByTestId(int)' is not implemented
|
||||
//Interface member 'int ProfessionalProfile.Interfaces.IQuestionRepo.GetIdByNameAndAssessmentId(string, int)' is not implemented
|
||||
public List<Question> GetAllByTestId(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Question.Where(x => x.assesmentTestId == id).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public int GetIdByNameAndAssessmentId(string question, int assessmentId)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Question.Where(x => x.questionText == question && x.assesmentTestId == assessmentId).Select(x => x.questionId).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class SkillRepo : ISkillRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
|
||||
public SkillRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(Skill item)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Skill.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var item = context.Skill.Find(id);
|
||||
context.Skill.Remove(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Skill> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Skill.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public Skill GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Skill.Find(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Skill> GetByUserId(int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public int GetIdByName(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Skill.Where(x => x.name == name).FirstOrDefault().skillId;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Skill item)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Skill.Update(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.Repo
|
||||
{
|
||||
public class UserRepo : IUserRepoInterface
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
|
||||
public UserRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(User item)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.User.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var user = context.User.Find(id);
|
||||
context.User.Remove(user);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<User> GetAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.User.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public User GetById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.User.Find(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.User.Update(user);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class VolunteeringRepo : IVolunteeringRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public VolunteeringRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(Volunteering item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Volunteering.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var volunteering = context.Volunteering.Find(id);
|
||||
context.Volunteering.Remove(volunteering);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<Volunteering> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Volunteering.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public Volunteering GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.Volunteering.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Volunteering volunteering)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Volunteering.Update(volunteering);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProfessionalProfile.DatabaseContext;
|
||||
using ProfessionalProfile.Domain;
|
||||
using ProfessionalProfile.Interfaces;
|
||||
|
||||
namespace ProfessionalProfile.repo
|
||||
{
|
||||
public class WorkExperienceRepo : IWorkExperienceRepo
|
||||
{
|
||||
private readonly IDbContextFactory<DataContext> _contextFactory;
|
||||
public WorkExperienceRepo(IDbContextFactory<DataContext> contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
}
|
||||
public void Add(WorkExperience item)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.WorkExperience.Add(item);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
var workExperience = context.WorkExperience.Find(id);
|
||||
context.WorkExperience.Remove(workExperience);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<WorkExperience> GetAll()
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.WorkExperience.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public WorkExperience GetById(int id)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
return context.WorkExperience.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(WorkExperience workExperience)
|
||||
{
|
||||
using (var context = _contextFactory.CreateDbContext())
|
||||
{
|
||||
context.WorkExperience.Update(workExperience);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user