public async Task <ApiBasket> Get(string userId) { IUserActor userActor = GetActor(userId); Dictionary <Guid, int> basketItems = await userActor.GetBasket(); ApiBasket apiBasket = new ApiBasket() { UserId = userId, Items = basketItems.Select(i => new ApiBasketItem { ProductId = i.Key.ToString(), Quantity = i.Value }).ToArray() }; return(apiBasket); }
public async Task <ApiBasket> GetAsync(string userId) { IUserActor actor = GetActor(userId); BasketItem[] basketItems = await actor.GetBasket(); ApiBasket result = new ApiBasket() { UserId = userId, Items = basketItems.Select(p => new ApiBasketItem() { ProductId = p.ProductId.ToString(), Quantity = p.Quantity }).ToArray() }; return(result); }