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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user