public IEnumerable <Cart> Carts() { return(_repository.GetCarts().ToList().Select(c => new Cart { CartId = c.CartId, ProductIds = DataTransferHelper.IdsToString(c.ProductIds) })); }
public async Task <Cart> Cart(string id) { var queryResult = await _repository.GetCartAsync(id, default); return(new Cart { CartId = queryResult.CartId, ProductIds = DataTransferHelper.IdsToString(queryResult.ProductIds) }); }
public async Task <Customer> Customer(string id) { var queryResult = await _repository.GetCustomerAsync(id, default); return(queryResult != null ? new Customer { Id = queryResult.CustomerId, CartId = queryResult.CartId, Name = queryResult.Name, Email = queryResult.Email, Addresses = DataTransferHelper.IdsToString(queryResult.Addresses), DiscountCard = queryResult.DiscountCard, WishlistId = queryResult.WishlistId, Orders = DataTransferHelper.IdsToString(queryResult.Orders) } : default);