public bool Add(OrderBLModel order) { OrderDataModel orderToAdd = Mapper.Map <OrderDataModel>(order); var orderDetailsToAdd = orderToAdd.OrderDetails; orderToAdd.OrderDetails = null; orderToAdd.OrderDate = DateTime.Now; _unitOfWork.OrderRepository.Create(orderToAdd); foreach (var item in orderDetailsToAdd) { item.ProductId = item.Game.Id; item.Game = null; item.OrderId = orderToAdd.Id; _unitOfWork.OrderDetailsRepository.Create(item); } return(_unitOfWork.OrderRepository.GetById(orderToAdd.Id) != null); }
public void Update(OrderBLModel model) { throw new NotImplementedException(); }
public void Create(OrderBLModel model) { var order = _mapper.Map <Order>(model); _orderRepository.Create(order); }