Esempio n. 1
0
        public async Task UpdateCartPosition(UpdateCartPositionDto updateCartPositionDto)
        {
            var cart = await _cartsRepository.GetEntity(updateCartPositionDto.CartId);

            if (cart == null)
            {
                return;
            }
            var list = await _listsRepository.GetListWithCarts(cart.ListId);

            var cartInNewPosition = list.Carts.Single(x => x.Position == updateCartPositionDto.NewPosition);

            cartInNewPosition.Position = cart.Position;
            cart.Position = updateCartPositionDto.NewPosition;
            await _cartsRepository.SaveChangesOnContext();
        }
Esempio n. 2
0
        public async Task <ActionResult> UpdatePosition(UpdateCartPositionDto updateCartPositionDto)
        {
            await _cartsService.UpdateCartPosition(updateCartPositionDto);

            return(new HttpStatusCodeResult(200));
        }