getfilteredlist дела
This commit is contained in:
parent
bf7b75cc1e
commit
898abeba91
@ -20,14 +20,14 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
}
|
||||
public List<CaseViewModel> GetFilteredList(CaseSearchModel model)
|
||||
{
|
||||
if (!model.DateFrom.HasValue && !model.DateTo.HasValue
|
||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue
|
||||
&& !model.ExecutorId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
if (model.ExecutorId.HasValue)
|
||||
{
|
||||
if (model.ExecutorId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Cases
|
||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||
@ -35,13 +35,23 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||
else if (model.ExecutorId.HasValue)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Cases
|
||||
.Include(x => x.Clients)
|
||||
.ThenInclude(x => x.Client)
|
||||
.Where(x => x.ExecutorId == model.ExecutorId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (!model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Cases.Include(x => x.CaseClients)
|
||||
.Include(x => x.Clients).ThenInclude(x => x.Client)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel).ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
|
@ -1,4 +1,5 @@
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmBusinessLogic.BusinessLogics;
|
||||
using LawFirmContracts.BindingModels;
|
||||
using LawFirmContracts.BusinessLogicContracts;
|
||||
using LawFirmContracts.SearchModels;
|
||||
using LawFirmContracts.ViewModels;
|
||||
@ -130,12 +131,12 @@ namespace LawFirmRestApi.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void AddClientToCase(Tuple<CaseSearchModel, ClientViewModel> model)
|
||||
{
|
||||
try
|
||||
public void AddClientToCase(Tuple<CaseSearchModel, int> model)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
_logic.AddClientToCase(model.Item1, model.Item2);
|
||||
var modelClient = _clientlogic.ReadElement(new ClientSearchModel { Id = model.Item2 });
|
||||
if (modelClient != null) _logic.AddClientToCase(model.Item1, modelClient);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user