Merge branch 'BaseLabWork03' into HardLabWork03
This commit is contained in:
commit
707314d25a
@ -72,12 +72,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)
|
||||
{
|
||||
@ -102,12 +97,7 @@ namespace FoodOrdersView
|
||||
{
|
||||
var operationResult = _logicO.FinishOrder(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)
|
||||
{
|
||||
@ -132,12 +122,7 @@ namespace FoodOrdersView
|
||||
{
|
||||
var operationResult = _logicO.DeliveryOrder(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)
|
||||
{
|
||||
|
@ -55,7 +55,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)
|
||||
@ -68,7 +71,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