Browse Source

Refactoring to use common BaseEntity class.

Fixed error on view page referencing old Models namespace.
main
Steve Smith 9 years ago
parent
commit
6d874ee3ef
  1. 7
      src/Business/Entities/BaseEntity.cs
  2. 3
      src/Business/Entities/CatalogBrand.cs
  3. 12
      src/Business/Entities/CatalogItem.cs
  4. 4
      src/Business/Entities/CatalogType.cs
  5. 2
      src/Web/Views/Catalog/_product.cshtml

7
src/Business/Entities/BaseEntity.cs

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

3
src/Business/Entities/CatalogBrand.cs

@ -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; }
}
}

12
src/Business/Entities/CatalogItem.cs

@ -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() { }
}
}

4
src/Business/Entities/CatalogType.cs

@ -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; }
}
}

2
src/Web/Views/Catalog/_product.cshtml

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

Loading…
Cancel
Save