Merge branch 'BaseLabWork03' into BaseLabWork04
This commit is contained in:
commit
acba6156a2
@ -76,12 +76,7 @@ namespace FoodOrdersView
|
||||
{
|
||||
var operationResult = _logicO.TakeOrderInWork(new OrderBindingModel
|
||||
{
|
||||
Id = id,
|
||||
DishId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DishId"].Value),
|
||||
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
|
||||
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
|
||||
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
|
||||
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
|
||||
Id = id
|
||||
});
|
||||
if (!operationResult)
|
||||
{
|
||||
|
@ -59,7 +59,10 @@ namespace FoodOrdersDatabaseImplement.Implements
|
||||
using var context = new FoodOrdersDatabase();
|
||||
context.Orders.Add(newOrder);
|
||||
context.SaveChanges();
|
||||
return newOrder.GetViewModel;
|
||||
return context.Orders
|
||||
.Include(x => x.Dish)
|
||||
.FirstOrDefault(x => x.Id == newOrder.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
@ -72,7 +75,10 @@ namespace FoodOrdersDatabaseImplement.Implements
|
||||
}
|
||||
order.Update(model);
|
||||
context.SaveChanges();
|
||||
return order.GetViewModel;
|
||||
return context.Orders
|
||||
.Include(x => x.Dish)
|
||||
.FirstOrDefault(x => x.Id == order.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
public OrderViewModel? Delete(OrderBindingModel model)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user