что такое безумие?

This commit is contained in:
bekodeg 2024-04-29 20:51:55 +04:00
parent 10ac29df01
commit 4b1d26dfb5
6 changed files with 22 additions and 14 deletions

View File

@ -3,6 +3,7 @@ using ComputerHardwareStoreContracts.BusinessLogicsContracts;
using ComputerHardwareStoreContracts.SearchModels;
using ComputerHardwareStoreContracts.StorageContracts;
using ComputerHardwareStoreContracts.ViewModels;
using ComputerHardwareStoreDataModels.Enums;
using Microsoft.Extensions.Logging;
namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
@ -78,7 +79,6 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
model.OrderProduct = element.OrderProduct;
model.DateCreate = element.DateCreate;
model.Status = element.Status;
model.Cost = element.Cost;
if (model.Status != orderStatus - 1)
{
@ -106,9 +106,9 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
{
return;
}
if (model.Cost <= 0)
if (model.Sum <= 0)
{
throw new ArgumentNullException("Цена заказа должна быть больше 0", nameof(model.Cost));
throw new ArgumentNullException("Цена заказа должна быть больше 0", nameof(model.Sum));
}
}
}

View File

@ -92,7 +92,7 @@ namespace ComputerHardwareStoreBusinessLogic.BusinessLogic
{
return;
}
if (string.IsNullOrEmpty(model.DateCreate))
if (model.DateCreate == null) // TODO чего блин, всмысле нет
{
throw new ArgumentNullException("Нет даты создания покупки", nameof(model.Date));
}

View File

@ -6,12 +6,10 @@ namespace ComputerHardwareStoreContracts.BindingModels
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
public int CannedId { get; set; }
public int Count { get; set; }
public double Cost { get; set; }
public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
public DateTime DateCreate { get; set; } = DateTime.Now;
public DateTime? DateImplement { get; set; }
public DateTime? DateImplement { get; set; } = null;
public Dictionary<int, (IProductModel, int)> OrderProduct { get; set; } = new();
}
}

View File

@ -4,7 +4,7 @@ using ComputerHardwareStoreContracts.ViewModels;
namespace ComputerHardwareStoreContracts.StorageContracts
{
public interface IBuidStorage
public interface IBuildStorage
{
List<BuildViewModel> GetFullList();
List<BuildViewModel> GetFilteredList(BuildSearchModel model);

View File

@ -1,15 +1,21 @@
using ComputerHardwareStoreDataModels.Models;
using ComputerHardwareStoreDataModels.Enums;
using ComputerHardwareStoreDataModels.Models;
using System.ComponentModel;
namespace ComputerHardwareStoreContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
[DisplayName("Номер")]
public int Id { get; set; }
[DisplayName("Стоимость")]
public double Cost { get; set; }
[DisplayName("Сумма")]
public double Sum { get; set; }
[DisplayName("Статус")]
public OrderStatus Status { get; set; }
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; }
[DisplayName("Дата выполнения")]
public DateTime? DateImplement { get; set; }
public Dictionary<int, (IProductModel, int)> OrderProduct { get; set; } = new();
}
}

View File

@ -1,9 +1,13 @@
namespace ComputerHardwareStoreDataModels.Models
using ComputerHardwareStoreDataModels.Enums;
namespace ComputerHardwareStoreDataModels.Models
{
public interface IOrderModel : IId
{
double Cost { get; }
double Sum { get; }
OrderStatus Status { get; }
DateTime DateCreate { get; }
DateTime? DateImplement { get; }
public Dictionary<int, (IProductModel, int)> OrderProduct { get; }
}
}