public void AddOrder(Order order) { Order d = new Order(); d.shippingId = order.Shipping_Company.Id; d.DateOfPayment = order.DateOfPayment; d.BuyerId = order.User.Id; d.Single = order.Single; try { db.Order.Add(d); db.SaveChanges(); } catch { } }
public void Edit_Order(int id, Order editO) { Order o = db.Order.FirstOrDefault(p => p.Id == id); o.DateOfPayment = editO.DateOfPayment.Value; o.Single = editO.Single; db.Entry(o).State = EntityState.Modified; db.SaveChanges(); }