Refactoring to use common BaseEntity class.

Fixed error on view page referencing old Models namespace.
This commit is contained in:
Steve Smith
2017-03-22 21:10:01 -04:00
parent c9a69a3105
commit 6d874ee3ef
5 changed files with 11 additions and 17 deletions

View File

@@ -0,0 +1,7 @@
namespace Microsoft.eShopWeb.Business.Entities
{
public class BaseEntity
{
public int Id { get; set; }
}
}

View File

@@ -1,8 +1,7 @@
namespace Microsoft.eShopWeb.Business.Entities namespace Microsoft.eShopWeb.Business.Entities
{ {
public class CatalogBrand public class CatalogBrand : BaseEntity
{ {
public int Id { get; set; }
public string Brand { get; set; } public string Brand { get; set; }
} }
} }

View File

@@ -1,25 +1,15 @@
namespace Microsoft.eShopWeb.Business.Entities namespace Microsoft.eShopWeb.Business.Entities
{ {
public class CatalogItem public class CatalogItem : BaseEntity
{ {
public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
public decimal Price { get; set; } public decimal Price { get; set; }
public string PictureUri { get; set; } public string PictureUri { get; set; }
public int CatalogTypeId { get; set; } public int CatalogTypeId { get; set; }
public CatalogType CatalogType { get; set; } public CatalogType CatalogType { get; set; }
public int CatalogBrandId { get; set; } public int CatalogBrandId { get; set; }
public CatalogBrand CatalogBrand { get; set; } public CatalogBrand CatalogBrand { get; set; }
public CatalogItem() { } public CatalogItem() { }
} }
} }

View File

@@ -1,9 +1,7 @@
namespace Microsoft.eShopWeb.Business.Entities namespace Microsoft.eShopWeb.Business.Entities
{ {
public class CatalogType public class CatalogType : BaseEntity
{ {
public int Id { get; set; }
public string Type { get; set; } public string Type { get; set; }
} }
} }

View File

@@ -1,4 +1,4 @@
@model Microsoft.eShopWeb.Models.CatalogItem @model Microsoft.eShopWeb.Business.Entities.CatalogItem
<form asp-controller="Cart" asp-action="AddToCart"> <form asp-controller="Cart" asp-action="AddToCart">