без конфликтов не обошлось, колдую дальше
This commit is contained in:
parent
e1bbc9ba93
commit
e30c3bed2e
@ -49,7 +49,7 @@ namespace AircraftPlantListImplement.Implements
|
|||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
var result = new List<OrderViewModel>();
|
var result = new List<OrderViewModel>();
|
||||||
if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue || !model.ClientId.HasValue)
|
if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -66,14 +66,6 @@ namespace AircraftPlantListImplement.Implements
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.ClientId.HasValue && !model.Id.HasValue)
|
|
||||||
{
|
|
||||||
foreach (var order in _source.Orders)
|
|
||||||
{
|
|
||||||
result.Add(GetViewModel(order));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
if (order.Id == model.Id)
|
if (order.Id == model.Id)
|
||||||
@ -180,16 +172,6 @@ namespace AircraftPlantListImplement.Implements
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var client in _source.Clients)
|
|
||||||
{
|
|
||||||
if (client.Id == order.ClientId)
|
|
||||||
{
|
|
||||||
viewModel.ClientFIO = client.ClientFIO;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return viewModel;
|
return viewModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,10 @@ namespace AircraftPlantFileImplement.Implements
|
|||||||
}
|
}
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue || !model.ClientId.HasValue)
|
if (!model.Id.HasValue || !model.DateFrom.HasValue || !model.DateTo.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.DateFrom.HasValue)
|
if (model.DateFrom.HasValue)
|
||||||
{
|
{
|
||||||
return _source.Orders
|
return _source.Orders
|
||||||
@ -36,15 +35,6 @@ namespace AircraftPlantFileImplement.Implements
|
|||||||
.Select(x => GetViewModel(x))
|
.Select(x => GetViewModel(x))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.ClientId.HasValue && !model.Id.HasValue)
|
|
||||||
{
|
|
||||||
return _source.Orders
|
|
||||||
.Where(x => x.ClientId == model.ClientId)
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _source.Orders.Where(x => x.Id.Equals(model.Id)).Select(x => GetViewModel(x)).ToList();
|
return _source.Orders.Where(x => x.Id.Equals(model.Id)).Select(x => GetViewModel(x)).ToList();
|
||||||
}
|
}
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
@ -94,9 +84,7 @@ namespace AircraftPlantFileImplement.Implements
|
|||||||
{
|
{
|
||||||
var viewModel = order.GetViewModel;
|
var viewModel = order.GetViewModel;
|
||||||
var plane = _source.Planes.FirstOrDefault(x => x.Id == order.PlaneId);
|
var plane = _source.Planes.FirstOrDefault(x => x.Id == order.PlaneId);
|
||||||
viewModel.PlaneName = plane?.PlaneName ?? string.Empty;
|
viewModel.PlaneName = plane?.PlaneName;
|
||||||
var client = _source.Clients.FirstOrDefault(x => x.Id == order.ClientId);
|
|
||||||
viewModel.ClientFIO = client?.ClientFIO ?? string.Empty;
|
|
||||||
return viewModel;
|
return viewModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user