示例#1
0
        public async Task <IActionResult> Delete(int id)
        {
            Checking checking = await checkingRepository.Get(id).ConfigureAwait(true);

            foreach (var item in checking.CheckingItems)
            {
                Item oldItem = await itemRepository.Get(item.ItemId).ConfigureAwait(true);

                oldItem.Quantity += item.Quantity;
                itemRepository.Edit(oldItem);
            }

            checkingRepository.Remove(checking);
            await unitOfWork.CompleteAsync().ConfigureAwait(true);

            return(Ok(mapper.Map <CheckingForGetDTO>(checking)));
        }
        public void Remove(int ingredientId, string userId)
        {
            var checking = CheckingRepo.GetChecking(ingredientId, userId);

            CheckingRepo.Remove(checking);
        }