Mochalov D.V. LabWork05_Hard #13
@ -154,6 +154,10 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия магазина!", nameof(model.Name));
|
||||
}
|
||||
if (model.MaxCountDocuments < 0)
|
||||
{
|
||||
throw new InvalidOperationException("Магазин с отрицательным количеством максимального количества документов!");
|
||||
}
|
||||
_logger.LogInformation("Shop. Name: {0}, Adress: {1}, ID: {2}", model.Name, model.Adress, model.Id);
|
||||
var element = _shopStorage.GetElement(new ShopSearchModel
|
||||
{
|
||||
|
@ -11,6 +11,27 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace LawFirmFileImplement.Implements
|
||||
{
|
||||
|
||||
|
||||
// Нужно узнать, проверять ли на наличие всех товаров, или только
|
||||
// наличие определенного товара
|
||||
// То же самое с продажей
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class ShopStorage : IShopStorage
|
||||
{
|
||||
private readonly DataFileSingleton source;
|
||||
|
@ -109,7 +109,7 @@ namespace LawFirmFileImplement.Models
|
||||
new XAttribute("Id", Id),
|
||||
new XElement("Name", Name),
|
||||
new XElement("Address", Adress),
|
||||
new XElement("MaxCountDocuments", MaxCountDocuments.ToString()),
|
||||
new XElement("MaxCountDocuments", MaxCountDocuments),
|
||||
new XElement("OpeningDate", OpeningDate.ToString()),
|
||||
new XElement("ShopDocuments", Documents.Select (x =>
|
||||
new XElement("ShopDocument",
|
||||
|
@ -21,6 +21,8 @@ namespace LawFirmListImplements.Models
|
||||
|
||||
public DateTime OpeningDate { get; private set; }
|
||||
|
||||
public int MaxCountDocuments { get; private set; }
|
||||
|
||||
public Dictionary<int, (IDocumentModel, int)> ShopDocuments { get; private set; } = new();
|
||||
|
||||
public static Shop? Create (ShopBindingModel model)
|
||||
@ -35,6 +37,7 @@ namespace LawFirmListImplements.Models
|
||||
Name = model.Name,
|
||||
Adress = model.Adress,
|
||||
OpeningDate = model.OpeningDate,
|
||||
MaxCountDocuments = model.MaxCountDocuments,
|
||||
ShopDocuments = new()
|
||||
};
|
||||
}
|
||||
@ -49,6 +52,7 @@ namespace LawFirmListImplements.Models
|
||||
Adress = model.Adress;
|
||||
OpeningDate = model.OpeningDate;
|
||||
ShopDocuments = model.ShopDocuments;
|
||||
MaxCountDocuments= model.MaxCountDocuments;
|
||||
}
|
||||
|
||||
public ShopViewModel GetViewModel => new()
|
||||
@ -57,7 +61,10 @@ namespace LawFirmListImplements.Models
|
||||
Name = Name,
|
||||
Adress = Adress,
|
||||
OpeningDate = OpeningDate,
|
||||
ShopDocuments = ShopDocuments
|
||||
ShopDocuments = ShopDocuments,
|
||||
MaxCountDocuments = MaxCountDocuments
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user