Browse Source
* resolve osbsolete method * put all properties as private, align unit test * fix version of version in MD, add instruction to install ef tool * fix url storedmain
committed by
GitHub
22 changed files with 162 additions and 99 deletions
@ -1,16 +1,34 @@ |
|||||
using Microsoft.eShopWeb.ApplicationCore.Interfaces; |
using Ardalis.GuardClauses; |
||||
|
using Microsoft.eShopWeb.ApplicationCore.Interfaces; |
||||
|
|
||||
namespace Microsoft.eShopWeb.ApplicationCore.Entities |
namespace Microsoft.eShopWeb.ApplicationCore.Entities |
||||
{ |
{ |
||||
public class CatalogItem : BaseEntity, IAggregateRoot |
public class CatalogItem : BaseEntity, IAggregateRoot |
||||
{ |
{ |
||||
public string Name { get; set; } |
public string Name { get; private set; } |
||||
public string Description { get; set; } |
public string Description { get; private set; } |
||||
public decimal Price { get; set; } |
public decimal Price { get; private set; } |
||||
public string PictureUri { get; set; } |
public string PictureUri { get; private set; } |
||||
public int CatalogTypeId { get; set; } |
public int CatalogTypeId { get; private set; } |
||||
public CatalogType CatalogType { get; set; } |
public CatalogType CatalogType { get; private set; } |
||||
public int CatalogBrandId { get; set; } |
public int CatalogBrandId { get; private set; } |
||||
public CatalogBrand CatalogBrand { get; set; } |
public CatalogBrand CatalogBrand { get; private set; } |
||||
|
|
||||
|
public CatalogItem(int catalogTypeId, int catalogBrandId, string description, string name, decimal price, string pictureUri) |
||||
|
{ |
||||
|
CatalogTypeId = catalogTypeId; |
||||
|
CatalogBrandId = catalogBrandId; |
||||
|
Description = description; |
||||
|
Name = name; |
||||
|
Price = price; |
||||
|
PictureUri = pictureUri; |
||||
|
} |
||||
|
|
||||
|
public void Update(string name, decimal price) |
||||
|
{ |
||||
|
Guard.Against.NullOrEmpty(name, nameof(name)); |
||||
|
Name = name; |
||||
|
Price = price; |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
Loading…
Reference in new issue