public List <long> SaveOrders(List <Order> pOrders) { using (var db = new OrderDContext()) { var saveOrder = db.Orders.AddRange(pOrders); db.SaveChanges(); return(saveOrder.Select(x => x.Id).ToList()); } }
public long SaveOrder(Order pOrder) { using (var db = new OrderDContext()) { var saveOrder = db.Orders.Add(pOrder); db.SaveChanges(); return(saveOrder.Id); } }
public bool UpdateOrders(List <Order> pOrders) { using (var db = new OrderDContext()) { foreach (var order in pOrders) { var updateOrders = db.Orders.SingleOrDefault(x => x.Id == order.Id); updateOrders.CustomerId = order.CustomerId; updateOrders.DateEvent = order.DateEvent; updateOrders.InventoryId = order.InventoryId; db.SaveChanges(); } return(true); } }