예제 #1
0
        public ActionResult Remove(int id)
        {
            Customers_Packages custPkg = db.Customers_Packages.Find(id);

            db.Customers_Packages.Remove(custPkg);
            db.SaveChangesAsync();
            return(RedirectToAction("Customer_Packages", "Home"));
        }
예제 #2
0
        public ActionResult Buy(int id)
        {
            Customers_Packages custPkg = new Customers_Packages();

            if (Session["custId"] != null)
            {
                int custId = (int)Session["custId"];
                custPkg.CustomerId = custId;
                custPkg.PackageId  = id;
                db.Customers_Packages.Add(custPkg);
                db.SaveChangesAsync();
                return(RedirectToAction("Customer_Packages", "Home"));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }