ПИбд-22 Боровков М В 5 лабораторная работа #6
@ -15,7 +15,7 @@ namespace SushiBarFileImplement.Implements
|
|||||||
}
|
}
|
||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
return source.Orders.Select(x => AttachSushiName(x.GetViewModel)).ToList();
|
return source.Orders.Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
@ -25,7 +25,7 @@ namespace SushiBarFileImplement.Implements
|
|||||||
}
|
}
|
||||||
return source.Orders.Where(x =>
|
return source.Orders.Where(x =>
|
||||||
x.Id == model.Id).Select(x =>
|
x.Id == model.Id).Select(x =>
|
||||||
AttachSushiName(x.GetViewModel)).ToList();
|
x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
@ -33,8 +33,8 @@ namespace SushiBarFileImplement.Implements
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return AttachSushiName(source.Orders.FirstOrDefault(x =>
|
return source.Orders.FirstOrDefault(x =>
|
||||||
(x.Id == model.Id))?.GetViewModel);
|
(x.Id == model.Id))?.GetViewModel;
|
||||||
}
|
}
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ namespace SushiBarFileImplement.Implements
|
|||||||
}
|
}
|
||||||
source.Orders.Add(newOrder);
|
source.Orders.Add(newOrder);
|
||||||
source.SaveOrders();
|
source.SaveOrders();
|
||||||
return AttachSushiName(newOrder.GetViewModel);
|
return newOrder.GetViewModel;
|
||||||
}
|
}
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -57,7 +57,7 @@ namespace SushiBarFileImplement.Implements
|
|||||||
}
|
}
|
||||||
order.Update(model);
|
order.Update(model);
|
||||||
source.SaveOrders();
|
source.SaveOrders();
|
||||||
return AttachSushiName(order.GetViewModel);
|
return order.GetViewModel;
|
||||||
}
|
}
|
||||||
public OrderViewModel? Delete(OrderBindingModel model)
|
public OrderViewModel? Delete(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -66,7 +66,7 @@ namespace SushiBarFileImplement.Implements
|
|||||||
{
|
{
|
||||||
source.Orders.Remove(element);
|
source.Orders.Remove(element);
|
||||||
source.SaveOrders();
|
source.SaveOrders();
|
||||||
return AttachSushiName(element.GetViewModel);
|
return element.GetViewModel;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ namespace SushiBarFileImplement.Models
|
|||||||
}
|
}
|
||||||
return new Order()
|
return new Order()
|
||||||
{
|
{
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
Id = Convert.ToInt32(element.Attribute("id")!.Value),
|
||||||
SushiId = Convert.ToInt32(element.Element("SushiId")!.Value),
|
SushiId = Convert.ToInt32(element.Element("SushiId")!.Value),
|
||||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||||
|
Loading…
Reference in New Issue
Block a user