реализации

This commit is contained in:
Ino 2023-03-27 11:05:16 +04:00
parent f6ff5668f3
commit 2767e576c9
24 changed files with 713 additions and 142 deletions

View File

@ -1,35 +1,115 @@
using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.BindingModels;
using IceCreamShopContracts.BusinessLogicsContracts; using IceCreamShopContracts.BusinessLogicsContracts;
using IceCreamShopContracts.SearchModels; using IceCreamShopContracts.SearchModels;
using IceCreamShopContracts.StoragesContracts;
using IceCreamShopContracts.ViewModels; using IceCreamShopContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace IceCreamBusinessLogic.BusinessLogics namespace IceCreamBusinessLogic.BusinessLogics
{ {
public class ClientLogic : IClientLogic public class ClientLogic : IClientLogic
{ {
private readonly ILogger _logger;
private readonly IClientStorage _clientStorage;
public ClientLogic(ILogger<ClientLogic> logger, IClientStorage clientStorage)
{
_logger = logger;
_clientStorage = clientStorage;
}
public bool Create(ClientBindingModel model) public bool Create(ClientBindingModel model)
{ {
throw new NotImplementedException(); CheckModel(model);
if (_clientStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
} }
public bool Delete(ClientBindingModel model) public bool Delete(ClientBindingModel model)
{ {
throw new NotImplementedException(); CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_clientStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
} }
public ClientViewModel? ReadElement(ClientSearchModel model) public ClientViewModel? ReadElement(ClientSearchModel model)
{ {
throw new NotImplementedException(); if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Email:{Email}.Id:{ Id}",
model.Email, model.Id);
var element = _clientStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
} }
public List<ClientViewModel>? ReadList(ClientSearchModel? model) public List<ClientViewModel>? ReadList(ClientSearchModel? model)
{ {
throw new NotImplementedException(); _logger.LogInformation("ReadList. Email:{Email}.Id:{ Id} ", model?.Email, model?.Id);
var list = (model == null) ? _clientStorage.GetFullList() :
_clientStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
} }
public bool Update(ClientBindingModel model) public bool Update(ClientBindingModel model)
{ {
throw new NotImplementedException(); CheckModel(model);
if (_clientStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(ClientBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.ClientFIO))
{
throw new ArgumentNullException("Нет фио клиента", nameof(model.ClientFIO));
}
if (string.IsNullOrEmpty(model.Email))
{
throw new ArgumentNullException("Нет логина клиента", nameof(model.Email));
}
_logger.LogInformation("Client. Id: {Id}, FIO: {fio}, email: {email}", model.Id, model.ClientFIO, model.Email);
var element = _clientStorage.GetElement(new ClientSearchModel
{
Email = model.Email,
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Клиент с таким логином уже есть");
}
} }
} }
} }

View File

@ -112,7 +112,6 @@ namespace IceCreamBusinessLogic.BusinessLogics
{ {
Id = viewModel.Id, Id = viewModel.Id,
IceCreamId = viewModel.IceCreamId, IceCreamId = viewModel.IceCreamId,
IceCreamName = viewModel.IceCreamName,
Status = viewModel.Status, Status = viewModel.Status,
DateCreate = viewModel.DateCreate, DateCreate = viewModel.DateCreate,
DateImplement = viewModel.DateImplement, DateImplement = viewModel.DateImplement,

View File

@ -28,111 +28,131 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.buttonCancel = new System.Windows.Forms.Button(); buttonCancel = new Button();
this.buttonSave = new System.Windows.Forms.Button(); buttonSave = new Button();
this.textBoxSum = new System.Windows.Forms.TextBox(); textBoxSum = new TextBox();
this.textBoxCount = new System.Windows.Forms.TextBox(); textBoxCount = new TextBox();
this.comboBoxIceCream = new System.Windows.Forms.ComboBox(); comboBoxIceCream = new ComboBox();
this.labelSum = new System.Windows.Forms.Label(); labelSum = new Label();
this.labelCount = new System.Windows.Forms.Label(); labelCount = new Label();
this.labelName = new System.Windows.Forms.Label(); labelName = new Label();
this.SuspendLayout(); comboBoxClient = new ComboBox();
labelClient = new Label();
SuspendLayout();
// //
// buttonCancel // buttonCancel
// //
this.buttonCancel.Location = new System.Drawing.Point(283, 114); buttonCancel.Location = new Point(243, 152);
this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); buttonCancel.Margin = new Padding(3, 2, 3, 2);
this.buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(82, 22); buttonCancel.Size = new Size(82, 22);
this.buttonCancel.TabIndex = 15; buttonCancel.TabIndex = 15;
this.buttonCancel.Text = "Отмена"; buttonCancel.Text = "Отмена";
this.buttonCancel.UseVisualStyleBackColor = true; buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); buttonCancel.Click += buttonCancel_Click;
// //
// buttonSave // buttonSave
// //
this.buttonSave.Location = new System.Drawing.Point(195, 114); buttonSave.Location = new Point(155, 152);
this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); buttonSave.Margin = new Padding(3, 2, 3, 2);
this.buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
this.buttonSave.Size = new System.Drawing.Size(82, 22); buttonSave.Size = new Size(82, 22);
this.buttonSave.TabIndex = 14; buttonSave.TabIndex = 14;
this.buttonSave.Text = "Сохранить"; buttonSave.Text = "Сохранить";
this.buttonSave.UseVisualStyleBackColor = true; buttonSave.UseVisualStyleBackColor = true;
this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click); buttonSave.Click += buttonSave_Click;
// //
// textBoxSum // textBoxSum
// //
this.textBoxSum.Location = new System.Drawing.Point(136, 75); textBoxSum.Location = new Point(95, 72);
this.textBoxSum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); textBoxSum.Margin = new Padding(3, 2, 3, 2);
this.textBoxSum.Name = "textBoxSum"; textBoxSum.Name = "textBoxSum";
this.textBoxSum.Size = new System.Drawing.Size(230, 23); textBoxSum.Size = new Size(230, 23);
this.textBoxSum.TabIndex = 13; textBoxSum.TabIndex = 13;
// //
// textBoxCount // textBoxCount
// //
this.textBoxCount.Location = new System.Drawing.Point(136, 41); textBoxCount.Location = new Point(95, 38);
this.textBoxCount.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); textBoxCount.Margin = new Padding(3, 2, 3, 2);
this.textBoxCount.Name = "textBoxCount"; textBoxCount.Name = "textBoxCount";
this.textBoxCount.Size = new System.Drawing.Size(230, 23); textBoxCount.Size = new Size(230, 23);
this.textBoxCount.TabIndex = 12; textBoxCount.TabIndex = 12;
this.textBoxCount.TextChanged += new System.EventHandler(this.textBoxCount_TextChanged); textBoxCount.TextChanged += textBoxCount_TextChanged;
// //
// comboBoxIceCream // comboBoxIceCream
// //
this.comboBoxIceCream.FormattingEnabled = true; comboBoxIceCream.FormattingEnabled = true;
this.comboBoxIceCream.Location = new System.Drawing.Point(136, 6); comboBoxIceCream.Location = new Point(95, 3);
this.comboBoxIceCream.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); comboBoxIceCream.Margin = new Padding(3, 2, 3, 2);
this.comboBoxIceCream.Name = "comboBoxIceCream"; comboBoxIceCream.Name = "comboBoxIceCream";
this.comboBoxIceCream.Size = new System.Drawing.Size(230, 23); comboBoxIceCream.Size = new Size(230, 23);
this.comboBoxIceCream.TabIndex = 11; comboBoxIceCream.TabIndex = 11;
this.comboBoxIceCream.SelectedIndexChanged += new System.EventHandler(this.comboBoxIceCream_SelectedIndexChanged); comboBoxIceCream.SelectedIndexChanged += comboBoxIceCream_SelectedIndexChanged;
// //
// labelSum // labelSum
// //
this.labelSum.AutoSize = true; labelSum.AutoSize = true;
this.labelSum.Location = new System.Drawing.Point(12, 80); labelSum.Location = new Point(12, 80);
this.labelSum.Name = "labelSum"; labelSum.Name = "labelSum";
this.labelSum.Size = new System.Drawing.Size(48, 15); labelSum.Size = new Size(48, 15);
this.labelSum.TabIndex = 10; labelSum.TabIndex = 10;
this.labelSum.Text = "Сумма:"; labelSum.Text = "Сумма:";
// //
// labelCount // labelCount
// //
this.labelCount.AutoSize = true; labelCount.AutoSize = true;
this.labelCount.Location = new System.Drawing.Point(12, 43); labelCount.Location = new Point(12, 43);
this.labelCount.Name = "labelCount"; labelCount.Name = "labelCount";
this.labelCount.Size = new System.Drawing.Size(75, 15); labelCount.Size = new Size(75, 15);
this.labelCount.TabIndex = 9; labelCount.TabIndex = 9;
this.labelCount.Text = "Количество:"; labelCount.Text = "Количество:";
// //
// labelName // labelName
// //
this.labelName.AutoSize = true; labelName.AutoSize = true;
this.labelName.Location = new System.Drawing.Point(12, 6); labelName.Location = new Point(12, 6);
this.labelName.Name = "labelName"; labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(77, 15); labelName.Size = new Size(77, 15);
this.labelName.TabIndex = 8; labelName.TabIndex = 8;
this.labelName.Text = "Мороженое:"; labelName.Text = "Мороженое:";
//
// comboBoxClient
//
comboBoxClient.FormattingEnabled = true;
comboBoxClient.Location = new Point(95, 111);
comboBoxClient.Name = "comboBoxClient";
comboBoxClient.Size = new Size(230, 23);
comboBoxClient.TabIndex = 17;
//
// labelClient
//
labelClient.AutoSize = true;
labelClient.Location = new Point(12, 114);
labelClient.Name = "labelClient";
labelClient.Size = new Size(49, 15);
labelClient.TabIndex = 16;
labelClient.Text = "Клиент:";
// //
// FormCreateOrder // FormCreateOrder
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(376, 150); ClientSize = new Size(334, 184);
this.Controls.Add(this.buttonCancel); Controls.Add(comboBoxClient);
this.Controls.Add(this.buttonSave); Controls.Add(labelClient);
this.Controls.Add(this.textBoxSum); Controls.Add(buttonCancel);
this.Controls.Add(this.textBoxCount); Controls.Add(buttonSave);
this.Controls.Add(this.comboBoxIceCream); Controls.Add(textBoxSum);
this.Controls.Add(this.labelSum); Controls.Add(textBoxCount);
this.Controls.Add(this.labelCount); Controls.Add(comboBoxIceCream);
this.Controls.Add(this.labelName); Controls.Add(labelSum);
this.Name = "FormCreateOrder"; Controls.Add(labelCount);
this.Text = "Заказ"; Controls.Add(labelName);
this.Load += new System.EventHandler(this.FormCreateOrder_Load); Name = "FormCreateOrder";
this.ResumeLayout(false); Text = "Заказ";
this.PerformLayout(); Load += FormCreateOrder_Load;
ResumeLayout(false);
PerformLayout();
} }
#endregion #endregion
@ -145,5 +165,7 @@
private Label labelSum; private Label labelSum;
private Label labelCount; private Label labelCount;
private Label labelName; private Label labelName;
private ComboBox comboBoxClient;
private Label labelClient;
} }
} }

View File

@ -19,12 +19,14 @@ namespace IceCreamShopView
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IIceCreamLogic _logicI; private readonly IIceCreamLogic _logicI;
private readonly IOrderLogic _logicO; private readonly IOrderLogic _logicO;
public FormCreateOrder(ILogger<FormCreateOrder> logger, IIceCreamLogic logicI, IOrderLogic logicO) private readonly IClientLogic _logicC;
public FormCreateOrder(ILogger<FormCreateOrder> logger, IIceCreamLogic logicI, IOrderLogic logicO, IClientLogic logicC)
{ {
InitializeComponent(); InitializeComponent();
_logger = logger; _logger = logger;
_logicI = logicI; _logicI = logicI;
_logicO = logicO; _logicO = logicO;
_logicC = logicC;
} }
private void FormCreateOrder_Load(object sender, EventArgs e) private void FormCreateOrder_Load(object sender, EventArgs e)
@ -47,6 +49,25 @@ namespace IceCreamShopView
_logger.LogError(ex, "Ошибка загрузки списка мороженого"); _logger.LogError(ex, "Ошибка загрузки списка мороженого");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
_logger.LogInformation("Загрузка клиентов для заказа");
try
{
var list = _logicC.ReadList(null);
if (list != null)
{
comboBoxClient.DisplayMember = "ClientFIO";
comboBoxClient.ValueMember = "Id";
comboBoxClient.DataSource = list;
comboBoxClient.SelectedItem = null;
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки списка клиентов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} }
private void textBoxCount_TextChanged(object sender, EventArgs e) private void textBoxCount_TextChanged(object sender, EventArgs e)
@ -95,13 +116,19 @@ namespace IceCreamShopView
MessageBox.Show("Выберите мороженое", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Выберите мороженое", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
if (comboBoxClient.SelectedValue == null)
{
MessageBox.Show("Выберите клиента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_logger.LogInformation("Создание заказа"); _logger.LogInformation("Создание заказа");
try try
{ {
var operationResult = _logicO.CreateOrder(new OrderBindingModel var operationResult = _logicO.CreateOrder(new OrderBindingModel
{ {
IceCreamId = Convert.ToInt32(comboBoxIceCream.SelectedValue), IceCreamId = Convert.ToInt32(comboBoxIceCream.SelectedValue),
IceCreamName = comboBoxIceCream.Text, ClientId = Convert.ToInt32(comboBoxClient.SelectedValue),
Count = Convert.ToInt32(textBoxCount.Text), Count = Convert.ToInt32(textBoxCount.Text),
Sum = Convert.ToDouble(textBoxSum.Text) Sum = Convert.ToDouble(textBoxSum.Text)
}); });

View File

@ -44,6 +44,7 @@ namespace IceCreamShopView
{ {
dataGridView.DataSource = list; dataGridView.DataSource = list;
dataGridView.Columns["IceCreamId"].Visible = false; dataGridView.Columns["IceCreamId"].Visible = false;
dataGridView.Columns["ClientId"].Visible = false;
} }
_logger.LogInformation("Загрузка заказов"); _logger.LogInformation("Загрузка заказов");
} }

View File

@ -7,6 +7,9 @@
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" /> <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" /> <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/IceCreamShopClientApp.styles.css" asp-append-version="true" /> <link rel="stylesheet" href="~/IceCreamShopClientApp.styles.css" asp-append-version="true" />
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
</head> </head>
<body> <body>
<header> <header>
@ -47,9 +50,6 @@
&copy; 2023 - IceCreamShopClientApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a> &copy; 2023 - IceCreamShopClientApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div> </div>
</footer> </footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false) @await RenderSectionAsync("Scripts", required: false)
</body> </body>
</html> </html>

View File

@ -12,7 +12,7 @@ namespace IceCreamShopContracts.BindingModels
{ {
public int Id { get; set; } public int Id { get; set; }
public int IceCreamId { get; set; } public int IceCreamId { get; set; }
public string IceCreamName { get; set; } = string.Empty; public int ClientId { get; set; }
public int Count { get; set; } public int Count { get; set; }
public double Sum { get; set; } public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;

View File

@ -13,17 +13,29 @@ namespace IceCreamShopContracts.ViewModels
{ {
[DisplayName("Номер")] [DisplayName("Номер")]
public int Id { get; set; } public int Id { get; set; }
public int IceCreamId { get; set; } public int IceCreamId { get; set; }
[DisplayName("Название")] [DisplayName("Название")]
public string IceCreamName { get; set; } = string.Empty; public string IceCreamName { get; set; } = string.Empty;
public int ClientId { get; set; }
[DisplayName("ФИО клиента")]
public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Количество")] [DisplayName("Количество")]
public int Count { get; set; } public int Count { get; set; }
[DisplayName("Сумма")] [DisplayName("Сумма")]
public double Sum { get; set; } public double Sum { get; set; }
[DisplayName("Статус")] [DisplayName("Статус")]
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
[DisplayName("Дата создания")] [DisplayName("Дата создания")]
public DateTime DateCreate { get; set; } = DateTime.Now; public DateTime DateCreate { get; set; } = DateTime.Now;
[DisplayName("Дата выполнения")] [DisplayName("Дата выполнения")]
public DateTime? DateImplement { get; set; } public DateTime? DateImplement { get; set; }
} }

View File

@ -10,6 +10,7 @@ namespace AbstractIceCreamShopDataModels.Models
public interface IOrderModel : IId public interface IOrderModel : IId
{ {
int IceCreamId { get; } int IceCreamId { get; }
int ClientId { get; }
int Count { get; } int Count { get; }
double Sum { get; } double Sum { get; }
OrderStatus Status { get; } OrderStatus Status { get; }

View File

@ -21,5 +21,6 @@ namespace IceCreamShopDatabaseImplement
public virtual DbSet<IceCreamComponent> IceCreamComponents { set; get; } public virtual DbSet<IceCreamComponent> IceCreamComponents { set; get; }
public virtual DbSet<Order> Orders { set; get; } public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<Client> Clients { set; get; }
} }
} }

View File

@ -2,6 +2,7 @@
using IceCreamShopContracts.SearchModels; using IceCreamShopContracts.SearchModels;
using IceCreamShopContracts.StoragesContracts; using IceCreamShopContracts.StoragesContracts;
using IceCreamShopContracts.ViewModels; using IceCreamShopContracts.ViewModels;
using IceCreamShopDatabaseImplement.Models;
namespace IceCreamShopDatabaseImplement.Implements namespace IceCreamShopDatabaseImplement.Implements
{ {
@ -9,32 +10,78 @@ namespace IceCreamShopDatabaseImplement.Implements
{ {
public ClientViewModel? Delete(ClientBindingModel model) public ClientViewModel? Delete(ClientBindingModel model)
{ {
throw new NotImplementedException(); using var context = new IceCreamShopDatabase();
var res = context.Clients.FirstOrDefault(x => x.Id == model.Id);
if (res != null)
{
context.Clients.Remove(res);
context.SaveChanges();
}
return res?.GetViewModel;
} }
public ClientViewModel? GetElement(ClientSearchModel model) public ClientViewModel? GetElement(ClientSearchModel model)
{ {
throw new NotImplementedException(); using var context = new IceCreamShopDatabase();
if (model.Id.HasValue)
return context.Clients.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
if (model.Email != null && model.Password != null)
return context.Clients
.FirstOrDefault(x => x.Email.Equals(model.Email)
&& x.Password.Equals(model.Password))
?.GetViewModel;
if (model.Email != null)
return context.Clients.FirstOrDefault(x => x.Email.Equals(model.Email))?.GetViewModel;
return null;
} }
public List<ClientViewModel> GetFilteredList(ClientSearchModel model) public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
{ {
throw new NotImplementedException(); if (model == null)
{
return new();
}
if (model.Id.HasValue)
{
var res = GetElement(model);
return res != null ? new() { res } : new();
}
if (model.Email != null)
{
using var context = new IceCreamShopDatabase();
return context.Clients
.Where(x => x.Email.Contains(model.Email))
.Select(x => x.GetViewModel)
.ToList();
}
return new();
} }
public List<ClientViewModel> GetFullList() public List<ClientViewModel> GetFullList()
{ {
throw new NotImplementedException(); using var context = new IceCreamShopDatabase();
return context.Clients.Select(x => x.GetViewModel).ToList();
} }
public ClientViewModel? Insert(ClientBindingModel model) public ClientViewModel? Insert(ClientBindingModel model)
{ {
throw new NotImplementedException(); using var context = new IceCreamShopDatabase();
var res = Client.Create(model);
if (res != null)
{
context.Clients.Add(res);
context.SaveChanges();
}
return res?.GetViewModel;
} }
public ClientViewModel? Update(ClientBindingModel model) public ClientViewModel? Update(ClientBindingModel model)
{ {
throw new NotImplementedException(); using var context = new IceCreamShopDatabase();
var res = context.Clients.FirstOrDefault(x => x.Id == model.Id);
res?.Update(model);
context.SaveChanges();
return res?.GetViewModel;
} }
} }
} }

View File

@ -13,7 +13,7 @@ namespace IceCreamShopDatabaseImplement.Implements
{ {
using var context = new IceCreamShopDatabase(); using var context = new IceCreamShopDatabase();
var element = context.Orders.FirstOrDefault(rec => rec.Id == model.Id); var element = context.Orders.Include(x => x.Client).FirstOrDefault(x => x.Id == model.Id);
if (element != null) if (element != null)
{ {
@ -34,28 +34,46 @@ namespace IceCreamShopDatabaseImplement.Implements
} }
using var context = new IceCreamShopDatabase(); using var context = new IceCreamShopDatabase();
return context.Orders.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel; return context.Orders
.Include(x => x.Client)
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
?.GetViewModel;
} }
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
if (model is null) return new(); if (model.Id.HasValue)
using var context = new IceCreamShopDatabase();
if (!model.Id.HasValue)
{ {
return context.Orders.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo). var result = GetElement(model);
Select(x => x.GetViewModel).ToList(); return result != null ? new() { result } : new();
} }
using var context = new IceCreamShopDatabase();
return context.Orders.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList(); if (model.DateFrom.HasValue && model.DateTo.HasValue)
{
return context.Orders
.Where(x => model.DateFrom <= x.DateCreate.Date && x.DateCreate <= model.DateTo)
.Include(x => x.Client)
.Select(x => x.GetViewModel)
.ToList();
}
if (model.ClientId.HasValue)
{
return context.Orders
.Where(x => x.Client.Id == model.ClientId)
.Include(x => x.Client)
.Select(x => x.GetViewModel)
.ToList();
}
return new();
} }
public List<OrderViewModel> GetFullList() public List<OrderViewModel> GetFullList()
{ {
using var context = new IceCreamShopDatabase(); using var context = new IceCreamShopDatabase();
return context.Orders
return context.Orders.Select(x => x.GetViewModel).ToList(); .Include(x => x.Client)
.Select(x => x.GetViewModel)
.ToList();
} }
public OrderViewModel? Insert(OrderBindingModel model) public OrderViewModel? Insert(OrderBindingModel model)
@ -72,14 +90,16 @@ namespace IceCreamShopDatabaseImplement.Implements
context.Orders.Add(newOrder); context.Orders.Add(newOrder);
context.SaveChanges(); context.SaveChanges();
return context.Orders.FirstOrDefault(x => x.Id == newOrder.Id)?.GetViewModel; return newOrder.GetViewModel;
} }
public OrderViewModel? Update(OrderBindingModel model) public OrderViewModel? Update(OrderBindingModel model)
{ {
using var context = new IceCreamShopDatabase(); using var context = new IceCreamShopDatabase();
var order = context.Orders.FirstOrDefault(x => x.Id == model.Id); var order = context.Orders
.Include(x => x.Client)
.FirstOrDefault(x => x.Id == model.Id);
if (order == null) if (order == null)
{ {
@ -89,7 +109,7 @@ namespace IceCreamShopDatabaseImplement.Implements
order.Update(model); order.Update(model);
context.SaveChanges(); context.SaveChanges();
return context.Orders.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; return order.GetViewModel;
} }
} }
} }

View File

@ -0,0 +1,59 @@
using IceCreamShopContracts.BindingModels;
using IceCreamShopContracts.ViewModels;
using AbstractIceCreamShopDataModels.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace IceCreamShopDatabaseImplement.Models
{
public class Client : IClientModel
{
[Required]
public string ClientFIO { get; private set; } = string.Empty;
[Required]
public string Email { get; private set; } = string.Empty;
[Required]
public string Password { get; private set; } = string.Empty;
public int Id { get; private set; }
[ForeignKey("ClientId")]
public virtual List<Order> Orders { get; set; } = new();
public static Client? Create(ClientBindingModel model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
ClientFIO = model.ClientFIO,
Email = model.Email,
Password = model.Password
};
}
public void Update(ClientBindingModel model)
{
if (model == null)
{
return;
}
ClientFIO = model.ClientFIO;
Email = model.Email;
Password = model.Password;
}
public ClientViewModel GetViewModel => new()
{
Id = Id,
ClientFIO = ClientFIO,
Email = Email,
Password = Password,
};
}
}

View File

@ -3,6 +3,7 @@ using AbstractIceCreamShopDataModels.Models;
using IceCreamShopContracts.BindingModels; using IceCreamShopContracts.BindingModels;
using IceCreamShopContracts.ViewModels; using IceCreamShopContracts.ViewModels;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Reflection.Metadata;
namespace IceCreamShopDatabaseImplement.Models namespace IceCreamShopDatabaseImplement.Models
{ {
@ -10,7 +11,8 @@ namespace IceCreamShopDatabaseImplement.Models
{ {
[Required] [Required]
public int IceCreamId { get; set; } public int IceCreamId { get; set; }
public string IceCreamName { get; private set; } = string.Empty; [Required]
public int ClientId { get; private set; }
[Required] [Required]
public int Count { get; set; } public int Count { get; set; }
[Required] [Required]
@ -23,7 +25,8 @@ namespace IceCreamShopDatabaseImplement.Models
public DateTime? DateImplement { get; set; } public DateTime? DateImplement { get; set; }
public int Id { get; set; } public int Id { get; set; }
public virtual Document Document { get; set; }
public virtual Client Client { get; set; }
public static Order? Create(OrderBindingModel? model) public static Order? Create(OrderBindingModel? model)
{ {
if (model == null) if (model == null)
@ -33,7 +36,7 @@ namespace IceCreamShopDatabaseImplement.Models
return new Order return new Order
{ {
IceCreamId = model.IceCreamId, IceCreamId = model.IceCreamId,
IceCreamName = model.IceCreamName, ClientId = model.ClientId,
Count = model.Count, Count = model.Count,
Sum = model.Sum, Sum = model.Sum,
Status = model.Status, Status = model.Status,
@ -53,16 +56,25 @@ namespace IceCreamShopDatabaseImplement.Models
DateImplement = model.DateImplement; DateImplement = model.DateImplement;
} }
public OrderViewModel GetViewModel => new() public OrderViewModel GetViewModel
{
get
{
var context = new IceCreamShopDatabase();
return new()
{ {
IceCreamId = IceCreamId, IceCreamId = IceCreamId,
IceCreamName = IceCreamName, ClientId = ClientId,
Count = Count, Count = Count,
Sum = Sum, Sum = Sum,
Status = Status, Status = Status,
DateCreate = DateCreate, DateCreate = DateCreate,
DateImplement = DateImplement, DateImplement = DateImplement,
Id = Id, Id = Id,
IceCreamName = context.IceCreams.FirstOrDefault(x => x.Id == IceCreamId)?.IceCreamName ?? string.Empty,
ClientFIO = context.Clients.FirstOrDefault(x => x.Id == ClientId)?.ClientFIO ?? string.Empty
}; };
} }
} }
}
}

View File

@ -14,9 +14,11 @@ namespace IceCreamShopFileImplement
private readonly string ComponentFileName = "Component.xml"; private readonly string ComponentFileName = "Component.xml";
private readonly string OrderFileName = "Order.xml"; private readonly string OrderFileName = "Order.xml";
private readonly string IceCreamFileName = "IceCream.xml"; private readonly string IceCreamFileName = "IceCream.xml";
private readonly string ClientFileName = "Client.xml";
public List<Component> Components { get; private set; } public List<Component> Components { get; private set; }
public List<Order> Orders { get; private set; } public List<Order> Orders { get; private set; }
public List<IceCream> IceCreams { get; private set; } public List<IceCream> IceCreams { get; private set; }
public List<Client> Clients { get; private set; }
public static DataFileSingleton GetInstance() public static DataFileSingleton GetInstance()
{ {
if (instance == null) if (instance == null)
@ -28,11 +30,13 @@ namespace IceCreamShopFileImplement
public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement); public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement);
public void SaveIceCreams() => SaveData(IceCreams, IceCreamFileName, "IceCreams", x => x.GetXElement); public void SaveIceCreams() => SaveData(IceCreams, IceCreamFileName, "IceCreams", x => x.GetXElement);
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement); public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
public void SaveClients() => SaveData(Clients, OrderFileName, "Clients", x => x.GetXElement);
private DataFileSingleton() private DataFileSingleton()
{ {
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!; Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
IceCreams = LoadData(IceCreamFileName, "IceCream", x => IceCream.Create(x)!)!; IceCreams = LoadData(IceCreamFileName, "IceCream", x => IceCream.Create(x)!)!;
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!; Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
} }
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction) private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
{ {

View File

@ -1,4 +1,5 @@
using IceCreamShopContracts.BindingModels; using IceCreamShopFileImplement.Models;
using IceCreamShopContracts.BindingModels;
using IceCreamShopContracts.SearchModels; using IceCreamShopContracts.SearchModels;
using IceCreamShopContracts.StoragesContracts; using IceCreamShopContracts.StoragesContracts;
using IceCreamShopContracts.ViewModels; using IceCreamShopContracts.ViewModels;
@ -7,34 +8,84 @@ namespace IceCreamShopFileImplement.Implements
{ {
public class ClientStorage : IClientStorage public class ClientStorage : IClientStorage
{ {
private readonly DataFileSingleton _source;
public ClientStorage()
{
_source = DataFileSingleton.GetInstance();
}
public ClientViewModel? Delete(ClientBindingModel model) public ClientViewModel? Delete(ClientBindingModel model)
{ {
throw new NotImplementedException(); var res = _source.Clients.FirstOrDefault(x => x.Id == model.Id);
if (res != null)
{
_source.Clients.Remove(res);
_source.SaveClients();
}
return res?.GetViewModel;
} }
public ClientViewModel? GetElement(ClientSearchModel model) public ClientViewModel? GetElement(ClientSearchModel model)
{ {
throw new NotImplementedException(); if (model.Id.HasValue)
return _source.Clients.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
if (model.Email != null && model.Password != null)
return _source.Clients
.FirstOrDefault(x => x.Email.Equals(model.Email)
&& x.Password.Equals(model.Password))
?.GetViewModel;
if (model.Email != null)
return _source.Clients.FirstOrDefault(x => x.Email.Equals(model.Email))?.GetViewModel;
return null;
} }
public List<ClientViewModel> GetFilteredList(ClientSearchModel model) public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
{ {
throw new NotImplementedException(); if (model == null)
{
return new();
}
if (model.Id.HasValue)
{
var res = GetElement(model);
return res != null ? new() { res } : new();
}
if (model.Email != null)
{
return _source.Clients
.Where(x => x.Email.Contains(model.Email))
.Select(x => x.GetViewModel)
.ToList();
}
return new();
} }
public List<ClientViewModel> GetFullList() public List<ClientViewModel> GetFullList()
{ {
throw new NotImplementedException(); return _source.Clients.Select(x => x.GetViewModel).ToList();
} }
public ClientViewModel? Insert(ClientBindingModel model) public ClientViewModel? Insert(ClientBindingModel model)
{ {
throw new NotImplementedException(); model.Id = _source.Clients.Count > 0 ? _source.Clients.Max(x => x.Id) + 1 : 1;
var res = Client.Create(model);
if (res != null)
{
_source.Clients.Add(res);
_source.SaveClients();
}
return res?.GetViewModel;
} }
public ClientViewModel? Update(ClientBindingModel model) public ClientViewModel? Update(ClientBindingModel model)
{ {
throw new NotImplementedException(); var res = _source.Clients.FirstOrDefault(x => x.Id == model.Id);
if (res != null)
{
res.Update(model);
_source.SaveClients();
}
return res?.GetViewModel;
} }
} }
} }

View File

@ -35,6 +35,15 @@ namespace IceCreamShopFileImplement.Implements
{ {
return new(); return new();
} }
if (model.ClientId.HasValue)
{
return source.Orders
.Where(x => x.ClientId == model.ClientId)
.Select(x => x.GetViewModel)
.ToList();
}
return source.Orders return source.Orders
.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo) .Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo)
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
@ -90,6 +99,13 @@ namespace IceCreamShopFileImplement.Implements
{ {
viewModel.IceCreamName = icecream.IceCreamName; viewModel.IceCreamName = icecream.IceCreamName;
} }
var client = source.Clients.FirstOrDefault(x => x.Id == order.ClientId);
if (client != null)
{
viewModel.ClientFIO = client.ClientFIO;
}
return viewModel; return viewModel;
} }
} }

View File

@ -0,0 +1,74 @@
using IceCreamShopContracts.BindingModels;
using IceCreamShopContracts.ViewModels;
using AbstractIceCreamShopDataModels.Models;
using System.Xml.Linq;
namespace IceCreamShopFileImplement.Models
{
public class Client : IClientModel
{
public string ClientFIO { get; private set; } = string.Empty;
public string Email { get; private set; } = string.Empty;
public string Password { get; private set; } = string.Empty;
public int Id { get; private set; }
public static Client? Create(ClientBindingModel model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
ClientFIO = model.ClientFIO,
Email = model.Email,
Password = model.Password
};
}
public static Client? Create(XElement element)
{
if (element == null)
{
return null;
}
return new()
{
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
ClientFIO = element.Element("FIO")!.Value,
Email = element.Element("Email")!.Value,
Password = element.Element("Password")!.Value,
};
}
public void Update(ClientBindingModel model)
{
if (model == null)
{
return;
}
ClientFIO = model.ClientFIO;
Email = model.Email;
Password = model.Password;
}
public ClientViewModel GetViewModel => new()
{
Id = Id,
ClientFIO = ClientFIO,
Email = Email,
Password = Password,
};
public XElement GetXElement => new("Client",
new XAttribute("Id", Id),
new XElement("FIO", ClientFIO),
new XElement("Email", Email),
new XElement("Password", Password)
);
}
}

View File

@ -15,8 +15,11 @@ namespace IceCreamShopFileImplement.Models
public class Order : IOrderModel public class Order : IOrderModel
{ {
public int Id { get; private set; } public int Id { get; private set; }
public int IceCreamId { get; private set; } public int IceCreamId { get; private set; }
public int ClientId { get; set; }
public int Count { get; private set; } public int Count { get; private set; }
public double Sum { get; private set; } public double Sum { get; private set; }
@ -36,6 +39,7 @@ namespace IceCreamShopFileImplement.Models
{ {
Id = model.Id, Id = model.Id,
IceCreamId = model.IceCreamId, IceCreamId = model.IceCreamId,
ClientId = model.ClientId,
Count = model.Count, Count = model.Count,
Sum = model.Sum, Sum = model.Sum,
Status = model.Status, Status = model.Status,
@ -53,6 +57,7 @@ namespace IceCreamShopFileImplement.Models
{ {
Id = Convert.ToInt32(element.Attribute("Id")!.Value), Id = Convert.ToInt32(element.Attribute("Id")!.Value),
IceCreamId = Convert.ToInt32(element.Element("IceCreamId")!.Value), IceCreamId = Convert.ToInt32(element.Element("IceCreamId")!.Value),
ClientId = Convert.ToInt32(element.Element("ClientId")!.Value),
Sum = Convert.ToDouble(element.Element("Sum")!.Value), Sum = Convert.ToDouble(element.Element("Sum")!.Value),
Count = Convert.ToInt32(element.Element("Count")!.Value), Count = Convert.ToInt32(element.Element("Count")!.Value),
Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value), Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value),
@ -73,6 +78,7 @@ namespace IceCreamShopFileImplement.Models
{ {
Id = Id, Id = Id,
IceCreamId = IceCreamId, IceCreamId = IceCreamId,
ClientId = ClientId,
Count = Count, Count = Count,
Sum = Sum, Sum = Sum,
Status = Status, Status = Status,
@ -83,6 +89,7 @@ namespace IceCreamShopFileImplement.Models
"Order", "Order",
new XAttribute("Id", Id), new XAttribute("Id", Id),
new XElement("IceCreamId", IceCreamId.ToString()), new XElement("IceCreamId", IceCreamId.ToString()),
new XElement("ClientId", ClientId),
new XElement("Count", Count.ToString()), new XElement("Count", Count.ToString()),
new XElement("Sum", Sum.ToString()), new XElement("Sum", Sum.ToString()),
new XElement("Status", Status.ToString()), new XElement("Status", Status.ToString()),

View File

@ -13,11 +13,13 @@ namespace IceCreamShopListImplement
public List<Component> Components { get; set; } public List<Component> Components { get; set; }
public List<Order> Orders { get; set; } public List<Order> Orders { get; set; }
public List<IceCream> iceCreams { get; set; } public List<IceCream> iceCreams { get; set; }
public List<Client> Clients { get; set; }
private DataListSingleton() private DataListSingleton()
{ {
Components = new List<Component>(); Components = new List<Component>();
Orders = new List<Order>(); Orders = new List<Order>();
iceCreams = new List<IceCream>(); iceCreams = new List<IceCream>();
Clients = new List<Client>();
} }
public static DataListSingleton GetInstance() public static DataListSingleton GetInstance()
{ {

View File

@ -2,39 +2,97 @@
using IceCreamShopContracts.SearchModels; using IceCreamShopContracts.SearchModels;
using IceCreamShopContracts.StoragesContracts; using IceCreamShopContracts.StoragesContracts;
using IceCreamShopContracts.ViewModels; using IceCreamShopContracts.ViewModels;
using IceCreamShopListImplement.Models;
namespace IceCreamShopListImplement.Implements namespace IceCreamShopListImplement.Implements
{ {
public class ClientStorage : IClientStorage public class ClientStorage : IClientStorage
{ {
private readonly DataListSingleton _source;
public ClientStorage()
{
_source = DataListSingleton.GetInstance();
}
public ClientViewModel? Delete(ClientBindingModel model) public ClientViewModel? Delete(ClientBindingModel model)
{ {
throw new NotImplementedException(); for (int i = 0; i < _source.Clients.Count; ++i)
{
if (_source.Clients[i].Id == model.Id)
{
var element = _source.Clients[i];
_source.Clients.RemoveAt(i);
return element.GetViewModel;
}
}
return null;
} }
public ClientViewModel? GetElement(ClientSearchModel model) public ClientViewModel? GetElement(ClientSearchModel model)
{ {
throw new NotImplementedException(); foreach (var client in _source.Clients)
{
if (model.Id.HasValue && model.Id == client.Id)
return client.GetViewModel;
if (model.Email != null && model.Password != null &&
client.Email.Equals(model.Email) && client.Password.Equals(model.Password))
return client.GetViewModel;
if (model.Email != null && client.Email.Equals(model.Email))
return client.GetViewModel;
}
return null;
} }
public List<ClientViewModel> GetFilteredList(ClientSearchModel model) public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
{ {
throw new NotImplementedException(); if (model == null)
{
return new();
}
var res = GetElement(model);
return res != null ? new() { res } : new();
} }
public List<ClientViewModel> GetFullList() public List<ClientViewModel> GetFullList()
{ {
throw new NotImplementedException(); var result = new List<ClientViewModel>();
foreach (var client in _source.Clients)
{
result.Add(client.GetViewModel);
}
return result;
} }
public ClientViewModel? Insert(ClientBindingModel model) public ClientViewModel? Insert(ClientBindingModel model)
{ {
throw new NotImplementedException(); model.Id = 1;
foreach (var client in _source.Clients)
{
if (model.Id <= client.Id)
{
model.Id = client.Id + 1;
}
}
var res = Client.Create(model);
if (res != null)
{
_source.Clients.Add(res);
}
return res?.GetViewModel;
} }
public ClientViewModel? Update(ClientBindingModel model) public ClientViewModel? Update(ClientBindingModel model)
{ {
throw new NotImplementedException(); foreach (var client in _source.Clients)
{
if (client.Id == model.Id)
{
client.Update(model);
return client.GetViewModel;
}
}
return null;
} }
} }
} }

View File

@ -47,13 +47,26 @@ namespace IceCreamShopListImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
var result = new List<OrderViewModel>(); var result = new List<OrderViewModel>();
if (!model.Id.HasValue) return result; if (model.DateFrom.HasValue && model.DateTo.HasValue)
{
foreach (var order in _source.Orders) foreach (var order in _source.Orders)
{ {
if (order.Id == model.Id || model.DateFrom <= order.DateCreate && order.DateCreate <= model.DateTo) if (order.Id == model.Id || model.DateFrom <= order.DateCreate && order.DateCreate <= model.DateTo)
{
result.Add(GetViewModel(order)); result.Add(GetViewModel(order));
} }
}
}
if (model.ClientId.HasValue)
{
foreach (var order in _source.Orders)
{
if (order.ClientId == model.ClientId)
{
result.Add(GetViewModel(order));
}
}
}
return result; return result;
} }
@ -110,6 +123,16 @@ namespace IceCreamShopListImplement.Implements
break; break;
} }
} }
foreach (var client in _source.Clients)
{
if (client.Id == order.ClientId)
{
viewModel.ClientFIO = client.ClientFIO;
break;
}
}
return viewModel; return viewModel;
} }
} }

View File

@ -0,0 +1,51 @@
using IceCreamShopContracts.BindingModels;
using IceCreamShopContracts.ViewModels;
using AbstractIceCreamShopDataModels.Models;
namespace IceCreamShopListImplement.Models
{
public class Client : IClientModel
{
public string ClientFIO { get; private set; } = string.Empty;
public string Email { get; private set; } = string.Empty;
public string Password { get; private set; } = string.Empty;
public int Id { get; private set; }
public static Client? Create(ClientBindingModel model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
ClientFIO = model.ClientFIO,
Email = model.Email,
Password = model.Password
};
}
public void Update(ClientBindingModel model)
{
if (model == null)
{
return;
}
ClientFIO = model.ClientFIO;
Email = model.Email;
Password = model.Password;
}
public ClientViewModel GetViewModel => new()
{
Id = Id,
ClientFIO = ClientFIO,
Email = Email,
Password = Password,
};
}
}

View File

@ -18,6 +18,8 @@ namespace IceCreamShopListImplement.Models
public int IceCreamId { get; private set; } public int IceCreamId { get; private set; }
public int ClientId { get; private set; }
public int Count { get; private set; } public int Count { get; private set; }
public double Sum { get; private set; } public double Sum { get; private set; }
@ -35,6 +37,7 @@ namespace IceCreamShopListImplement.Models
{ {
Id = model.Id, Id = model.Id,
IceCreamId = model.IceCreamId, IceCreamId = model.IceCreamId,
ClientId = model.ClientId,
Count = model.Count, Count = model.Count,
Sum = model.Sum, Sum = model.Sum,
Status = model.Status, Status = model.Status,
@ -54,6 +57,7 @@ namespace IceCreamShopListImplement.Models
{ {
Id = Id, Id = Id,
IceCreamId = IceCreamId, IceCreamId = IceCreamId,
ClientId = ClientId,
Count = Count, Count = Count,
Sum = Sum, Sum = Sum,
Status = Status, Status = Status,