public Entity.CustomerOrderHistory ParseCustomerOrderHistory(Model.CustomerOrderHistory customerOrderHistory) { if (customerOrderHistory.Id == null) { return(new Entity.CustomerOrderHistory { LocId = customerOrderHistory.LocId, CustId = customerOrderHistory.CustId, OrderDate = customerOrderHistory.OrderDate, OrderId = customerOrderHistory.OrderId, Total = customerOrderHistory.Total, }); } return(new Entity.CustomerOrderHistory { LocId = customerOrderHistory.LocId, CustId = customerOrderHistory.CustId, OrderDate = customerOrderHistory.OrderDate, OrderId = customerOrderHistory.OrderId, Total = customerOrderHistory.Total, Id = (int)customerOrderHistory.Id }); }
public Model.CustomerOrderHistory AddCustomerOrderHistory(Model.CustomerOrderHistory newCustomerOrderHistory) { _context.CustomerOrderHistories.Add(_mapper.ParseCustomerOrderHistory(newCustomerOrderHistory)); _context.SaveChanges(); return(newCustomerOrderHistory); }