Adding cart/basket support and applicationuser (without EF requirement)
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Interfaces\" />
|
||||
<PackageReference Include="System.Security.Claims" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
10
src/ApplicationCore/Entities/ApplicationUser.cs
Normal file
10
src/ApplicationCore/Entities/ApplicationUser.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace ApplicationCore.Entities
|
||||
{
|
||||
public class ApplicationUser : ClaimsIdentity
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
public string UserName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace Microsoft.eShopWeb.ApplicationCore.Entities
|
||||
{
|
||||
public class BaseEntity
|
||||
public class BaseEntity<T>
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public T Id { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
10
src/ApplicationCore/Entities/Basket.cs
Normal file
10
src/ApplicationCore/Entities/Basket.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.eShopWeb.ApplicationCore.Entities
|
||||
{
|
||||
public class Basket : BaseEntity<string>
|
||||
{
|
||||
public string BuyerId { get; set; }
|
||||
public List<BasketItem> Items { get; set; } = new List<BasketItem>();
|
||||
}
|
||||
}
|
||||
9
src/ApplicationCore/Entities/BasketItem.cs
Normal file
9
src/ApplicationCore/Entities/BasketItem.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Microsoft.eShopWeb.ApplicationCore.Entities
|
||||
{
|
||||
public class BasketItem : BaseEntity<string>
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
public decimal UnitPrice { get; set; }
|
||||
public int Quantity { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Microsoft.eShopWeb.ApplicationCore.Entities
|
||||
{
|
||||
public class CatalogBrand : BaseEntity
|
||||
public class CatalogBrand : BaseEntity<int>
|
||||
{
|
||||
public string Brand { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Microsoft.eShopWeb.ApplicationCore.Entities
|
||||
{
|
||||
public class CatalogItem : BaseEntity
|
||||
public class CatalogItem : BaseEntity<int>
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Microsoft.eShopWeb.ApplicationCore.Entities
|
||||
{
|
||||
public class CatalogType : BaseEntity
|
||||
public class CatalogType : BaseEntity<int>
|
||||
{
|
||||
public string Type { get; set; }
|
||||
}
|
||||
|
||||
18
src/ApplicationCore/Interfaces/IBasketService.cs
Normal file
18
src/ApplicationCore/Interfaces/IBasketService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using ApplicationCore.Entities;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Entities;
|
||||
using System.Security.Principal;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ApplicationCore.Interfaces
|
||||
{
|
||||
public interface IBasketService
|
||||
{
|
||||
Task<Basket> GetBasket(ApplicationUser user);
|
||||
}
|
||||
|
||||
public interface IIdentityParser<T>
|
||||
{
|
||||
T Parse(IPrincipal principal);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user