From d9af3176b7876c3f4e65500d1d589f80c6856a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=90=D0=BB=D0=B5=D0=B9?= =?UTF-8?q?=D0=BA=D0=B8=D0=BD?= Date: Thu, 18 May 2023 00:43:44 +0400 Subject: [PATCH] BenchFix --- .../Controllers/LawyerController.cs | 85 ++++++++++++++++++ .../Controllers/SpecializationController.cs | 86 +++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 CaseAccounting/CaseAccountingRestApi/Controllers/LawyerController.cs create mode 100644 CaseAccounting/CaseAccountingRestApi/Controllers/SpecializationController.cs diff --git a/CaseAccounting/CaseAccountingRestApi/Controllers/LawyerController.cs b/CaseAccounting/CaseAccountingRestApi/Controllers/LawyerController.cs new file mode 100644 index 0000000..716033a --- /dev/null +++ b/CaseAccounting/CaseAccountingRestApi/Controllers/LawyerController.cs @@ -0,0 +1,85 @@ +using CaseAccountingContracts.BindingModels; +using CaseAccountingContracts.BusinessLogicContracts; +using CaseAccountingContracts.SearchModels; +using CaseAccountingContracts.ViewModels; +using Microsoft.AspNetCore.Mvc; + +namespace CaseAccountingRestApi.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class LawyerController : Controller + { + private readonly ILawyerLogic lawyerLogic; + + public LawyerController(ILawyerLogic logic) + { + lawyerLogic = logic; + } + + [HttpGet] + public LawyerViewModel? Get(int id) + { + try + { + return lawyerLogic.ReadElement(new LawyerSearchModel { Id = id }); + } + catch (Exception) + { + throw; + } + } + + [HttpGet] + public List? GetAllByUser(int userId) + { + try + { + return lawyerLogic.ReadList(null); + } + catch (Exception) + { + throw; + } + } + + [HttpPost] + public void Create(LawyerBindingModel model) + { + try + { + lawyerLogic.Create(model); + } + catch (Exception) + { + throw; + } + } + + [HttpPost] + public void Update(LawyerBindingModel model) + { + try + { + lawyerLogic.Update(model); + } + catch (Exception) + { + throw; + } + } + + [HttpPost] + public void Delete(LawyerBindingModel model) + { + try + { + lawyerLogic.Delete(new() { Id = model.Id }); + } + catch (Exception) + { + throw; + } + } + } +} diff --git a/CaseAccounting/CaseAccountingRestApi/Controllers/SpecializationController.cs b/CaseAccounting/CaseAccountingRestApi/Controllers/SpecializationController.cs new file mode 100644 index 0000000..49e7dc6 --- /dev/null +++ b/CaseAccounting/CaseAccountingRestApi/Controllers/SpecializationController.cs @@ -0,0 +1,86 @@ +using CaseAccountingBusinessLogic.BusinessLogics; +using CaseAccountingContracts.BindingModels; +using CaseAccountingContracts.BusinessLogicContracts; +using CaseAccountingContracts.SearchModels; +using CaseAccountingContracts.ViewModels; +using Microsoft.AspNetCore.Mvc; + +namespace CaseAccountingRestApi.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class SpecializationController : Controller + { + private readonly ISpecializationLogic specializationLogic; + + public SpecializationController(ISpecializationLogic logic) + { + specializationLogic = logic; + } + + [HttpGet] + public SpecializationViewModel? Get(int id) + { + try + { + return specializationLogic.ReadElement(new SpecializationSearchModel { Id = id }); + } + catch (Exception) + { + throw; + } + } + + [HttpGet] + public List? GetAllByUser(int userId) + { + try + { + return specializationLogic.ReadList(null); + } + catch (Exception) + { + throw; + } + } + + [HttpPost] + public void Create(SpecializationBindingModel model) + { + try + { + specializationLogic.Create(model); + } + catch (Exception) + { + throw; + } + } + + [HttpPost] + public void Update(SpecializationBindingModel model) + { + try + { + specializationLogic.Update(model); + } + catch (Exception) + { + throw; + } + } + + [HttpPost] + public void Delete(SpecializationBindingModel model) + { + try + { + specializationLogic.Delete(new() { Id = model.Id }); + } + catch (Exception) + { + throw; + } + } + } +}