public void Products(OrderItem orderitem) { using (var db = new OrderItemContext()) { db.Entry(orderitem).State = EntityState.Added; db.SaveChanges(); } }
public void PutProduct(string id, OrderItem orderitem) { orderitem.Id = id; using (var db = new OrderItemContext()){ var order = db.OrderItems.SingleOrDefault(o => o.Id == id); db.Remove(order); db.Add(orderitem); db.SaveChanges(); } }
public int?Add(OrderItem entity) { _orderItemContext.OrderItems.Add(entity); _orderItemContext.SaveChanges(); return(entity.ID); }