Исправления и добавления
This commit is contained in:
parent
335cda61e4
commit
2c54d51c2c
@ -114,5 +114,17 @@ namespace FurnitureAssemblyBusinessLogic
|
||||
throw new InvalidOperationException("Магазин с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
|
||||
public bool AddFurniture(ShopBindingModel model, FurnitureBindingModel furnitureModel, int count)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if (_shopStorage.AddFurniture(model, furnitureModel, count) == null)
|
||||
{
|
||||
_logger.LogWarning("Replenishment operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,5 +16,6 @@ namespace FurnitureAssemblyContracts.BusinessLogicsContarcts
|
||||
bool Create(ShopBindingModel model);
|
||||
bool Update(ShopBindingModel model);
|
||||
bool Delete(ShopBindingModel model);
|
||||
bool AddFurniture(ShopBindingModel model, FurnitureBindingModel furnitureModel, int count);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,7 @@
|
||||
using FurnitureAssemblyContracts.BindingModels;
|
||||
using FurnitureAssemblyContracts.SearchModels;
|
||||
using FurnitureAssemblyContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace FurnitureAssemblyContracts.StoragesContracts
|
||||
{
|
||||
@ -17,5 +13,6 @@ namespace FurnitureAssemblyContracts.StoragesContracts
|
||||
ShopViewModel? Insert(ShopBindingModel model);
|
||||
ShopViewModel? Update(ShopBindingModel model);
|
||||
ShopViewModel? Delete(ShopBindingModel model);
|
||||
ShopViewModel? AddFurniture(ShopBindingModel model, FurnitureBindingModel furniture, int count);
|
||||
}
|
||||
}
|
||||
|
@ -109,5 +109,18 @@ namespace FurnitureAssemblyListImplement.Implements
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ShopViewModel? AddFurniture(ShopBindingModel model, FurnitureBindingModel furniture, int count)
|
||||
{
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
if (shop.Id == model.Id)
|
||||
{
|
||||
shop.AddFurniture(model, furniture, count);
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user