BenchFix
This commit is contained in:
parent
312cccab9c
commit
d9af3176b7
@ -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<LawyerViewModel>? 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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<SpecializationViewModel>? 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user