Esempio n. 1
0
        public static int Create(OrderHistoryDTO orderHistory, JewelleryDBEntities db)
        {
            var newOrderHistory = OrderHistoryMapper.MapToEntity(orderHistory);

            db.OrderHistory.Add(newOrderHistory);

            db.SaveChanges();

            return(newOrderHistory.HID);
        }
Esempio n. 2
0
 public static OrderHistory MapToEntity(OrderHistoryDTO orderHistory)
 {
     return(new OrderHistory()
     {
         HID = orderHistory.HID,
         OrderId = orderHistory.OrderId,
         AccountId = orderHistory.AccountId,
         ProductId = orderHistory.ProductId,
         Price = orderHistory.Price,
         Quantity = orderHistory.Quantity,
         OrderState = orderHistory.OrderState,
         ResponsibleAccountId = orderHistory.ResponsibleAccountId,
         Remarks = orderHistory.Remarks,
         UpdateTime = DateTime.Now
     });
 }
Esempio n. 3
0
        private List <OrderHistoryDTO> GetOrderHistory(long orderId)
        {
            List <OrderHistory>    orderHistories   = unitOfWork.OrderHistoryRepository.Get(c => c.OrderId == orderId).ToList();
            List <OrderHistoryDTO> orderHistoryDTOs = new List <OrderHistoryDTO>();

            foreach (var orderHistory in orderHistories)
            {
                OrderHistoryDTO orderHistoryDTO = new OrderHistoryDTO();
                orderHistoryDTO.DateAdded   = orderHistory.DateAdded;
                orderHistoryDTO.Description = orderHistory.Description;
                orderHistoryDTO.Id          = orderHistory.Id;
                orderHistoryDTO.NotifyUser  = orderHistory.NotifyUser;
                orderHistoryDTO.State       = orderHistory.State;
                orderHistoryDTOs.Add(orderHistoryDTO);
            }
            return(orderHistoryDTOs);
        }