Product-enhancements-and-validation-fixes
This commit is contained in:
@@ -95,6 +95,7 @@ public class ProductService : IProductService
|
||||
Price = product.Price,
|
||||
Weight = product.Weight,
|
||||
WeightUnit = product.WeightUnit,
|
||||
StockQuantity = product.StockQuantity,
|
||||
CategoryId = product.CategoryId,
|
||||
CategoryName = product.Category.Name,
|
||||
CreatedAt = product.CreatedAt,
|
||||
@@ -117,10 +118,11 @@ public class ProductService : IProductService
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Name = createProductDto.Name,
|
||||
Description = createProductDto.Description,
|
||||
Description = string.IsNullOrEmpty(createProductDto.Description) ? " " : createProductDto.Description,
|
||||
Price = createProductDto.Price,
|
||||
Weight = createProductDto.Weight,
|
||||
WeightUnit = createProductDto.WeightUnit,
|
||||
StockQuantity = createProductDto.StockQuantity,
|
||||
CategoryId = createProductDto.CategoryId,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
UpdatedAt = DateTime.UtcNow,
|
||||
@@ -169,6 +171,9 @@ public class ProductService : IProductService
|
||||
if (updateProductDto.WeightUnit.HasValue)
|
||||
product.WeightUnit = updateProductDto.WeightUnit.Value;
|
||||
|
||||
if (updateProductDto.StockQuantity.HasValue)
|
||||
product.StockQuantity = updateProductDto.StockQuantity.Value;
|
||||
|
||||
if (updateProductDto.CategoryId.HasValue)
|
||||
product.CategoryId = updateProductDto.CategoryId.Value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user