PIbd-21. Raspaev N. I. HardLabWork05 #13

Closed
Nikolay-Raspaev wants to merge 23 commits from HardLabWork05 into HardLabWork04
3 changed files with 11 additions and 7 deletions
Showing only changes of commit 4178c24cd2 - Show all commits

View File

@ -85,7 +85,10 @@ namespace FoodOrdersDatabaseImplement.Implements
}
updateShop.Update(model);
context.SaveChanges();
updateShop.UpdateDish(context, model);
if (model.ShopDishes.Count != 0)
{
updateShop.UpdateDish(context, model);
}
transaction.Commit();
return updateShop.GetViewModel;
}

View File

@ -1,5 +1,6 @@
using FoodOrdersContracts.BindingModels;
using FoodOrdersContracts.BusinessLogicsContracts;
using FoodOrdersContracts.SearchModels;
using FoodOrdersContracts.ViewModels;
using Microsoft.AspNetCore.Mvc;
using System.Text.Json;
@ -83,9 +84,9 @@ namespace FoodOrdersRestApi.Controllers
public void DeleteShop(ShopBindingModel model) => CRUDShop(() => _logic.Delete(model));
[HttpPost]
public void AddDishInShop(Tuple<DishViewModel, int> countDishForShop)
public void AddDishInShop(Tuple<ShopSearchModel, DishViewModel, int> countDishForShop)
{
CRUDShop(() => _logic.AddDishes(countDishForShop.Item1, countDishForShop.Item2));
}
CRUDShop(() => _logic.DeliveryDishes(countDishForShop.Item1, countDishForShop.Item2, countDishForShop.Item3));
}
}
}

View File

@ -70,7 +70,7 @@ namespace FoodOrdersShopApp.Controllers
}
[HttpPost]
public void Create(string shopname, string address, int maxCount)
public void Create(string name, string address, int maxCount)
{
if (APIClient.IsAccessAllowed is false)
{
@ -80,7 +80,7 @@ namespace FoodOrdersShopApp.Controllers
{
throw new Exception("Количество и сумма должны быть больше 0");
}
if (string.IsNullOrEmpty(shopname))
if (string.IsNullOrEmpty(name))
{
throw new Exception($"Имя магазина не должно быть пустым");
}
@ -90,7 +90,7 @@ namespace FoodOrdersShopApp.Controllers
}
APIClient.PostRequest("api/shop/createshop", new ShopBindingModel
{
ShopName = shopname,
ShopName = name,
Address = address,
Capacity = maxCount,
});