This commit is contained in:
Safgerd 2023-05-20 05:52:38 +04:00
parent 2cc83f06cb
commit 50e7193a47
10 changed files with 10 additions and 12 deletions

View File

@ -97,7 +97,6 @@ namespace ComputerStoreBusinessLogic.BusinessLogic
if (model == null) { return; } if (model == null) { return; }
if (!withParams) { return; } if (!withParams) { return; }
if (model.Price <= 0) { throw new ArgumentNullException("Invalid consignment's price", nameof(model)); } if (model.Price <= 0) { throw new ArgumentNullException("Invalid consignment's price", nameof(model)); }
if (string.IsNullOrEmpty(model.OrderID.ToString())) { throw new ArgumentNullException("Invalid Consignment's order ID", nameof(model)); }
_logger.LogInformation("Consignment. Consignment ID:{ ID}. Order ID:{ OrderID}.", model.ID, model.OrderID); _logger.LogInformation("Consignment. Consignment ID:{ ID}. Order ID:{ OrderID}.", model.ID, model.OrderID);
} }

View File

@ -97,7 +97,6 @@ namespace ComputerStoreBusinessLogic.BusinessLogic
if (model == null) { return; } if (model == null) { return; }
if (!withParams) { return; } if (!withParams) { return; }
if (model.Price <= 0) { throw new ArgumentNullException("Invalid request's price", nameof(model)); } if (model.Price <= 0) { throw new ArgumentNullException("Invalid request's price", nameof(model)); }
if (string.IsNullOrEmpty(model.OrderID.ToString())) { throw new ArgumentNullException("Invalid Request's order ID", nameof(model)); }
_logger.LogInformation("Request. Request ID:{ ID}. Order ID: { OrderID}. PC ID: { PCID}", model.ID, model.OrderID, model.PCID); _logger.LogInformation("Request. Request ID:{ ID}. Order ID: { OrderID}. PC ID: { PCID}", model.ID, model.OrderID, model.PCID);
} }

View File

@ -10,7 +10,7 @@ namespace ComputerStoreContracts.BindingModels
public class ConsignmentBindingModel : IConsignmentModel public class ConsignmentBindingModel : IConsignmentModel
{ {
public int ID { get; set; } public int ID { get; set; }
public int OrderID { get; set; } public int? OrderID { get; set; }
public double Price { get; set; } public double Price { get; set; }
public Dictionary<int, (IProductModel, int)> ConsignmentProducts { get; set; } = new(); public Dictionary<int, (IProductModel, int)> ConsignmentProducts { get; set; } = new();
} }

View File

@ -10,7 +10,7 @@ namespace ComputerStoreContracts.BindingModels
public class RequestBindingModel : IRequestModel public class RequestBindingModel : IRequestModel
{ {
public int ID { get; set; } public int ID { get; set; }
public int OrderID { get; set; } public int? OrderID { get; set; }
public double Price { get; set; } public double Price { get; set; }
public int? PCID { get; set; } public int? PCID { get; set; }

View File

@ -13,7 +13,7 @@ namespace ComputerStoreContracts.ViewModels
[DisplayName("Consignment ID")] [DisplayName("Consignment ID")]
public int ID { get; set; } public int ID { get; set; }
[DisplayName("Order ID")] [DisplayName("Order ID")]
public int OrderID { get; set; } public int? OrderID { get; set; }
[DisplayName("Price")] [DisplayName("Price")]
public double Price { get; set; } public double Price { get; set; }

View File

@ -13,7 +13,7 @@ namespace ComputerStoreContracts.ViewModels
[DisplayName("Request ID")] [DisplayName("Request ID")]
public int ID { get; set; } public int ID { get; set; }
[DisplayName("Order ID")] [DisplayName("Order ID")]
public int OrderID { get; set; } public int? OrderID { get; set; }
[DisplayName("Price")] [DisplayName("Price")]
public double Price { get; set; } public double Price { get; set; }

View File

@ -8,7 +8,7 @@ namespace ComputerStoreDataModels.Models
{ {
public interface IConsignmentModel : IID public interface IConsignmentModel : IID
{ {
int OrderID { get; } int? OrderID { get; }
double Price { get; } double Price { get; }
Dictionary<int, (IProductModel, int)> ConsignmentProducts { get; } Dictionary<int, (IProductModel, int)> ConsignmentProducts { get; }
} }

View File

@ -8,7 +8,7 @@ namespace ComputerStoreDataModels.Models
{ {
public interface IRequestModel : IID public interface IRequestModel : IID
{ {
int OrderID { get; } int? OrderID { get; }
int? PCID { get; } int? PCID { get; }
double Price { get; } double Price { get; }

View File

@ -16,8 +16,7 @@ namespace ComputerStoreDatabaseImplement.Models
{ {
public int ID { get; private set; } public int ID { get; private set; }
[Required] public int? OrderID { get; private set; }
public int OrderID { get; private set; }
public virtual Order Order { get; set; } public virtual Order Order { get; set; }
[Required] [Required]
@ -68,6 +67,7 @@ namespace ComputerStoreDatabaseImplement.Models
return; return;
} }
Price = model.Price; Price = model.Price;
OrderID = model.OrderID;
} }
public ConsignmentViewModel GetViewModel => new() public ConsignmentViewModel GetViewModel => new()
{ {

View File

@ -19,8 +19,7 @@ namespace ComputerStoreDatabaseImplement.Models
{ {
public int ID { get; private set; } public int ID { get; private set; }
[Required] public int? OrderID { get; private set; }
public int OrderID { get; private set; }
public virtual Order Order { get; set; } public virtual Order Order { get; set; }
public int? PCID { get; private set; } public int? PCID { get; private set; }
@ -61,6 +60,7 @@ namespace ComputerStoreDatabaseImplement.Models
} }
Price = model.Price; Price = model.Price;
PCID = model.PCID; PCID = model.PCID;
OrderID = model.OrderID;
RequestComponents = model.RequestComponents; RequestComponents = model.RequestComponents;
} }