Exemple #1
0
        public ActionResult AddPackageSpot(Package_Spots ps)
        {
            var name = ViewBag.PACKAGENAME;

            if (ModelState.IsValid)
            {
                using (var context = new DestCoveryContext())
                {
                    context.Package_spt.Add(ps);

                    context.SaveChanges();

                    return(RedirectToAction("PackageDetails", "Admin", new { @packageid = ps.Package_Id, @packagename = TempData["PACKAGENAME"] }));
                }
            }
            else
            {
                return(View());
            }
        }
Exemple #2
0
        public ActionResult UpdatePackageSpot(Package_Spots ps, int packageid, string packagename)
        {
            if (Session["AdminID"] == null)
            {
                return(RedirectToAction("login", "Admin"));
            }
            else
            {
                ViewBag.PACKAGEID   = packageid;
                ViewBag.PACKAGENAME = packagename;

                DestCoveryContext dcc = new DestCoveryContext();
                var data = dcc.Package_spt.Find(ps.Spot_Id);
                if (data != null)
                {
                    data.Spot_Name        = ps.Spot_Name;
                    data.Spot_Description = ps.Spot_Description;
                }

                dcc.SaveChanges();
                return(RedirectToAction("PackageDetails", "Admin", new { @packageid = packageid, @packagename = packagename }));
            }
        }