30 lines
738 B
C#
30 lines
738 B
C#
using Microsoft.AspNetCore.Components;
|
|
using ShopOnline.Models.Dtos;
|
|
using ShopOnline.Web.Services.Contracts;
|
|
|
|
namespace ShopOnline.Web.Pages
|
|
{
|
|
public class ShoppingCartBase:ComponentBase
|
|
{
|
|
[Inject]
|
|
public IShoppingCartService ShoppingCartService { get; set; }
|
|
|
|
public IEnumerable<CartItemDto> ShoppingCartItems { get; set; }
|
|
|
|
public string ErrorMessage { get; set; }
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
ShoppingCartItems = await ShoppingCartService.GetItems(HardCoded.UserId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ErrorMessage = ex.Message;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|