Beispiel #1
0
        public async Task Update(Domain.ShoppingCart prod)
        {
            var result = await _database.StringSetAsync(prod.CustomerId.ToString(), JsonConvert.SerializeObject(prod));

            if (!result)
            {
                _logger.LogInformation("Failed to update the shopping cart");
            }

            await GetByID(prod.CustomerId);
        }
Beispiel #2
0
        private GetShoppingCartResponse GetCartDTO(Domain.ShoppingCart cart)
        {
            if (cart == null)
            {
                return(new GetShoppingCartResponse(true, ResponseAction.NotFound));
            }
            var cartDTO  = mapper.Map <ShoppingCartDTO>(cart);
            var response = new GetShoppingCartResponse(cartDTO, true, ResponseAction.Found);

            response.ResponseAction = ResponseAction.Found;
            return(response);
        }
Beispiel #3
0
 public async Task SaveAsync(Domain.ShoppingCart cart)
 {
     await context.SaveAndPublishAsync(cart, context.ShoppingCarts);
 }
Beispiel #4
0
 private void UpdateShoppingCart(Domain.ShoppingCart shoppingCart, EditShoppingCartCommand request)
 {
     shoppingCart.Update(request.Model.Description);
     repository.Update(shoppingCart);
     repository.Save();
 }
Beispiel #5
0
 public Task Add(Domain.ShoppingCart prod)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
        public async Task <IActionResult> Post([FromBody] Domain.ShoppingCart cart)
        {
            await _repository.Update(cart);

            return(Ok());
        }