public void EditOrder(Orders order)
 {
     var oldorder = _db.Orders.FirstOrDefault(t => t.OrderId == order.OrderId);
     _db.Orders.DeleteObject(oldorder);
     _db.AddToOrders(order);
     _db.SaveChanges();
 }
 public ActionResult _AddOrder(Orders order)
 {
     if (ModelState.IsValid)
     {
         order.CheckOrder = false;
         order.Status = 1;
         db.AddOrder(order);
         return RedirectToAction("_ListUserOrders");
     }
     else
     {
         return RedirectToAction("_AddOrder", order);
     }
 }
 public ActionResult _AddOrder()
 {
     var order = new Orders();
     order.ClientId = 1;
     return View(order);
 }
 public ActionResult Edit(Orders order)
 {
     db.EditOrder(order);
     return RedirectToAction("_ListUserOrders");
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOrders(Orders orders)
 {
     base.AddObject("Orders", orders);
 }
 /// <summary>
 /// Create a new Orders object.
 /// </summary>
 /// <param name="orderId">Initial value of the OrderId property.</param>
 /// <param name="clientId">Initial value of the ClientId property.</param>
 /// <param name="uRL">Initial value of the URL property.</param>
 /// <param name="productId">Initial value of the ProductId property.</param>
 /// <param name="productName">Initial value of the ProductName property.</param>
 /// <param name="price">Initial value of the Price property.</param>
 /// <param name="deliveryPrice">Initial value of the DeliveryPrice property.</param>
 /// <param name="count">Initial value of the Count property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 public static Orders CreateOrders(global::System.Int32 orderId, global::System.Int32 clientId, global::System.String uRL, global::System.Int32 productId, global::System.String productName, global::System.Single price, global::System.Single deliveryPrice, global::System.Int32 count, global::System.Int32 status)
 {
     Orders orders = new Orders();
     orders.OrderId = orderId;
     orders.ClientId = clientId;
     orders.URL = uRL;
     orders.ProductId = productId;
     orders.ProductName = productName;
     orders.Price = price;
     orders.DeliveryPrice = deliveryPrice;
     orders.Count = count;
     orders.Status = status;
     return orders;
 }
 public void AddOrder(Orders order)
 {
     _db.AddToOrders(order);
     _db.SaveChanges();
 }