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(); }
public async Task <ActionResult> UpdatePosition(UpdateCartPositionDto updateCartPositionDto) { await _cartsService.UpdateCartPosition(updateCartPositionDto); return(new HttpStatusCodeResult(200)); }