示例#1
0
        public async Task EditOrderItemAsync(int Id, JsonPatchDocument <OrderItemForUpdate> patchDocument)
        {
            //try
            //{
            var OrderItem = await _orderItemRepository.findbyIdAsync(Id);

            var OrderItemForUpdateDto = _mapper.Map <OrderItemForUpdate>(OrderItem);

            patchDocument.ApplyTo(OrderItemForUpdateDto);

            _mapper.Map(OrderItemForUpdateDto, OrderItem);

            await _orderItemRepository.EditAsync(OrderItem);

            await _orderItemRepository.SaveAsync();

            //}
            //catch (Exception)
            //{
            //    throw new NotFoundException();
            //}
        }