/// <summary>
 /// Deprecated Method for adding a new object to the shipTo EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToshipTo(shipTo shipTo)
 {
     base.AddObject("shipTo", shipTo);
 }
        public ActionResult pvIndex()
        {
            shipTo st = new shipTo();
            var t=(from i in db.formOfP select i).ToList() ;
            var tables = (from i in db.Tables select i).ToList();
            ViewBag.stList = t;
            ViewBag.Tables = tables;

            return View(st);
        }
 /// <summary>
 /// Create a new shipTo object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="tableNum">Initial value of the tableNum property.</param>
 /// <param name="orderDateTime">Initial value of the OrderDateTime property.</param>
 /// <param name="formOfP">Initial value of the formOfP property.</param>
 /// <param name="flImmediateBill">Initial value of the flImmediateBill property.</param>
 public static shipTo CreateshipTo(global::System.Int64 id, global::System.Int32 tableNum, global::System.DateTime orderDateTime, global::System.Int32 formOfP, global::System.Boolean flImmediateBill)
 {
     shipTo shipTo = new shipTo();
     shipTo.ID = id;
     shipTo.tableNum = tableNum;
     shipTo.OrderDateTime = orderDateTime;
     shipTo.formOfP = formOfP;
     shipTo.flImmediateBill = flImmediateBill;
     return shipTo;
 }
        public ActionResult CartSubmit([Bind(Exclude = "flPaid,dtPaid,WaiterID")]int? a, int? b, int? с, FormCollection fc)
        {
            //shipTo par = new shipTo(Session["sKorzina"] as Dictionary<itCart, int>);
            shipTo par = new shipTo();
            TryUpdateModel(par);

            if (ModelState.IsValid)
            {

                db.AddToshipTo(par);

                Dictionary<itCart, int> itCarts = Session["sKorzina"] as Dictionary<itCart, int>;
                if (itCarts != null)
                {
                    foreach (var i in itCarts)
                    {
                        if (i.Value > 0)
                        {
                            i.Key.num = (short)i.Value;
                            i.Key.shipToID = par.ID;
                            db.AddToitCart(i.Key);

                        }

                    }
                    db.SaveChanges();
                    ordDbServ.SetOrderState((int)par.ID, "Создан заказ", User.Identity.Name);
                    if (par.flImmediateBill)
                        ordDbServ.SetPayState((int)par.ID, "Счёт запрошен", User.Identity.Name);
                    else
                        ordDbServ.SetPayState((int)par.ID, "Счёт не запрошен", User.Identity.Name);
                    Session.Abandon();
                    return RedirectToAction("pvCashOrCart", "Shipping", new { ShipToID = par.ID });
                }
                else
                    return RedirectToAction("pvCashOrCart", "Shipping", new { ShipToID = par.ID });
            }
            else
            {
                var t = (from i in db.formOfP select i).ToList();
                ViewBag.stList = t;
                return View("pvIndex",par);
            }
        }