public Order Add(OrderForCreationDto orderDto) { var order = orderDto.MapToOrder(); _orderRepository.Add(order); UpdateProductQuantity(order.OrderDetails); _unitOfWork.SaveChanges(); return(order); }
public Order Update(OrderForCreationDto orderDto, int orderId) { var order = orderDto.MapToOrder(orderId); order.Id = orderId; order.ModifiedDate = DateTime.Now; _orderRepository.Update(order); UpdateProductQuantity(order.OrderDetails); _unitOfWork.SaveChanges(); return(order); }