Upload files to 'ShipyardFileImplement'

This commit is contained in:
Ivan_Starostin 2024-06-02 16:41:31 +04:00
parent 185143cdb1
commit 886cfe9f3a

View File

@ -24,14 +24,16 @@ namespace ShipyardFileImplement.Implements
}
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
if (!model.Id.HasValue)
{
return new();
}
return source.Orders
.Where(x => x.Id == model.Id)
.Select(x => AccessShipStorage(x.GetViewModel))
.ToList();
.Where(x => (
(!model.Id.HasValue || x.Id == model.Id) &&
(!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) &&
(!model.DateTo.HasValue || x.DateCreate <= model.DateTo)
)
)
.Select(x => AccessShipStorage(x.GetViewModel))
.ToList();
}
public OrderViewModel? GetElement(OrderSearchModel model)
{
@ -82,7 +84,14 @@ namespace ShipyardFileImplement.Implements
{
if (model == null)
return null;
model = source.Ships.Where(x => x.Id == model.ShipId).FirstOrDefault();
foreach (var Ship in source.Ships)
{
if (Ship.Id == model.ShipId)
{
model.ShipName = Ship.ShipName;
break;
}
}
return model;
}
}