public Entity.CustomerOrderLineItem ParseCustomerOrderLineItem(Model.CustomerOrderLineItem customerOrderLineItem)
        {
            if (customerOrderLineItem.Id == null)
            {
                return(new Entity.CustomerOrderLineItem
                {
                    OrderId = customerOrderLineItem.OrderId,
                    ProdId = customerOrderLineItem.ProdId,
                    Quantity = customerOrderLineItem.Quantity,
                    ProdPrice = customerOrderLineItem.ProdPrice,
                });
            }

            return(new Entity.CustomerOrderLineItem
            {
                OrderId = customerOrderLineItem.OrderId,
                ProdId = customerOrderLineItem.ProdId,
                Quantity = customerOrderLineItem.Quantity,
                ProdPrice = customerOrderLineItem.ProdPrice,
                Id = (int)customerOrderLineItem.Id
            });
        }
Exemple #2
0
 public Model.CustomerOrderLineItem AddCustomerOrderLineItem(Model.CustomerOrderLineItem newCustomerOrderLineItem)
 {
     _context.CustomerOrderLineItems.Add(_mapper.ParseCustomerOrderLineItem(newCustomerOrderLineItem));
     _context.SaveChanges();
     return(newCustomerOrderLineItem);
 }