add new models for store

This commit is contained in:
Viltskaa 2023-02-13 15:18:58 +04:00
parent 9399daba9e
commit ae4eef9254
6 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,13 @@
using SushiBarDataModels.Models;
namespace SushiBarContracts.BindingModels
{
public class StoreBindingModel
{
public string StoreName { get; set; } = string.Empty;
public string StoreAdress { get; set; } = string.Empty;
public DateTime OpeningDate { get; set; } = DateTime.Now;
public Dictionary<int, (ISushiModel, int)> Sushis { get; set; } = new();
public int Id { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using SushiBarContracts.BindingModels;
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models;
namespace SushiBarContracts.BusinessLogicsContracts
{
public interface IStoreLogic
{
List<StoreViewModel>? ReadList(StoreSearchModel? model);
StoreViewModel? ReadElement(StoreSearchModel model);
bool Create(StoreBindingModel model);
bool Update(StoreBindingModel model);
bool Delete(StoreBindingModel model);
bool AddPackage(StoreSearchModel model, ISushiModel sushi, int quantity);
}
}

View File

@ -0,0 +1,8 @@
namespace SushiBarContracts.SearchModels
{
public class StoreSearchModel
{
public int? Id { get; set; }
public string? StoreName { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using SushiBarContracts.BindingModels;
using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels;
namespace SushiBarContracts.StoragesContracts
{
public interface IStoreStorage
{
List<StoreViewModel> GetFullList();
List<StoreViewModel> GetFilteredList(StoreSearchModel model);
StoreViewModel? GetElement(StoreSearchModel model);
StoreViewModel? Insert(StoreBindingModel model);
StoreViewModel? Update(StoreBindingModel model);
StoreViewModel? Delete(StoreBindingModel model);
}
}

View File

@ -0,0 +1,18 @@
using SushiBarDataModels.Models;
using System.ComponentModel;
namespace SushiBarContracts.ViewModels
{
public class StoreViewModel : IStoreModel
{
public Dictionary<int, (ISushiModel, int)> Sushis { get; set; } = new();
public int Id { get; set; }
[DisplayName("Name store")]
public string StoreName { get; set; } = string.Empty;
[DisplayName("Adress store")]
public string StoreAdress { get; set; } = string.Empty;
[DisplayName("Date opening")]
public DateTime OpeningDate { get; set; } = DateTime.Now;
}
}

View File

@ -0,0 +1,10 @@
namespace SushiBarDataModels.Models
{
public interface IStoreModel : IId
{
public string StoreName { get; set; }
public string StoreAdress { get; set; }
DateTime OpeningDate { get; }
Dictionary<int, (ISushiModel, int)> Sushis { get; }
}
}