Merge branch 'Lab5_Hard' into Lab6_Hard
This commit is contained in:
commit
b4e81d4ee3
@ -100,6 +100,8 @@ namespace PizzeriaBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
throw new ArgumentException("Магазина не существует");
|
throw new ArgumentException("Магазина не существует");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (shop.ShopPizzas.ContainsKey(model.PizzaId))
|
if (shop.ShopPizzas.ContainsKey(model.PizzaId))
|
||||||
{
|
{
|
||||||
var oldValue = shop.ShopPizzas[model.PizzaId];
|
var oldValue = shop.ShopPizzas[model.PizzaId];
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using PizzeriaDataModels.Models;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -8,7 +9,7 @@ namespace PizzeriaContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class PizzaCount
|
public class PizzaCount
|
||||||
{
|
{
|
||||||
public PizzaViewModel Pizza { get; set; } = new();
|
public PizzaViewModel Pizza { get; set; }
|
||||||
|
|
||||||
public int Count { get; set; } = new();
|
public int Count { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,11 @@ namespace PizzeriaShopRestApi.Controllers
|
|||||||
return new ShopPizzaViewModel
|
return new ShopPizzaViewModel
|
||||||
{
|
{
|
||||||
Shop = shop,
|
Shop = shop,
|
||||||
ShopPizza = shop?.ShopPizzas?.ToDictionary(x => x.Key, x => new PizzaCount{ Pizza = x.Value.Item1 as PizzaViewModel, Count = x.Value.Item2 })
|
ShopPizza = shop.ShopPizzas.ToDictionary(x => x.Key, x => new PizzaCount { Pizza = new PizzaViewModel() { Id = x.Value.Item1.Id,
|
||||||
|
PizzaName = x.Value.Item1.PizzaName,
|
||||||
|
PizzaComponents = x.Value.Item1.PizzaComponents,
|
||||||
|
Price = x.Value.Item1.Price,
|
||||||
|
}, Count = x.Value.Item2 })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
Loading…
Reference in New Issue
Block a user