Refactoring to use common BaseEntity class.
Fixed error on view page referencing old Models namespace.
This commit is contained in:
7
src/Business/Entities/BaseEntity.cs
Normal file
7
src/Business/Entities/BaseEntity.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Microsoft.eShopWeb.Business.Entities
|
||||
{
|
||||
public class BaseEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
namespace Microsoft.eShopWeb.Business.Entities
|
||||
{
|
||||
public class CatalogBrand
|
||||
public class CatalogBrand : BaseEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Brand { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
namespace Microsoft.eShopWeb.Business.Entities
|
||||
{
|
||||
public class CatalogItem
|
||||
public class CatalogItem : BaseEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public decimal Price { get; set; }
|
||||
|
||||
public string PictureUri { get; set; }
|
||||
|
||||
public int CatalogTypeId { get; set; }
|
||||
|
||||
public CatalogType CatalogType { get; set; }
|
||||
|
||||
public int CatalogBrandId { get; set; }
|
||||
|
||||
public CatalogBrand CatalogBrand { get; set; }
|
||||
|
||||
public CatalogItem() { }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
namespace Microsoft.eShopWeb.Business.Entities
|
||||
{
|
||||
public class CatalogType
|
||||
public class CatalogType : BaseEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Type { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@model Microsoft.eShopWeb.Models.CatalogItem
|
||||
@model Microsoft.eShopWeb.Business.Entities.CatalogItem
|
||||
|
||||
|
||||
<form asp-controller="Cart" asp-action="AddToCart">
|
||||
|
||||
Reference in New Issue
Block a user