コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ResortLocation resortLocation = db.ResortLocations.Find(id);

            db.ResortLocations.Remove(resortLocation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ResortLocationID,ResortName,Address,City,State,ZipCode,Phone")] ResortLocation resortLocation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(resortLocation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(resortLocation));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "ResortLocationID,ResortName,Address,City,State,ZipCode,Phone")] ResortLocation resortLocation)
        {
            if (ModelState.IsValid)
            {
                db.ResortLocations.Add(resortLocation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(resortLocation));
        }
コード例 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            //ResortLocation resortLocation = db.ResortLocations.Find(id);
            //db.ResortLocations.Remove(resortLocation);
            //db.SaveChanges();
            ResortLocation resortLocation = uow.ResortRepository.Find(id);

            uow.ResortRepository.Remove(resortLocation);
            uow.Save();
            return(RedirectToAction("Index"));
        }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "ResortLocationID,ResortName,Address,City,State,ZipCode,ReservationLimit")] ResortLocation resortLocation)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(resortLocation).State = System.Data.Entity.EntityState.Modified;
         //db.SaveChanges();
         uow.ResortRepository.Update(resortLocation);
         uow.Save();
         return(RedirectToAction("Index"));
     }
     return(View(resortLocation));
 }
コード例 #6
0
        public ActionResult Create([Bind(Include = "ResortLocationID,ResortName,Address,City,State,ZipCode,ReservationLimit")] ResortLocation resortLocation)
        {
            if (ModelState.IsValid)
            {
                //db.ResortLocations.Add(resortLocation);
                //db.SaveChanges();
                uow.ResortRepository.Add(resortLocation);
                uow.Save();
                return(RedirectToAction("Index"));
            }

            return(View(resortLocation));
        }
コード例 #7
0
        // GET: ResortLocations/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ResortLocation resortLocation = db.ResortLocations.Find(id);

            if (resortLocation == null)
            {
                return(HttpNotFound());
            }
            return(View(resortLocation));
        }
コード例 #8
0
        // GET: ResortLocations/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //ResortLocation resortLocation = db.ResortLocations.Find(id);
            ResortLocation resortLocation = uow.ResortRepository.Find(id);

            if (resortLocation == null)
            {
                return(HttpNotFound());
            }
            return(View(resortLocation));
        }
コード例 #9
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //ResortLocation resortLocation = db.ResortLocations.Find(id);

            ViewBag.PetID         = new SelectList(uow.PetRepository.Get(), "PetID", "Name");
            ViewBag.ReservationID = new SelectList(uow.ReservationRepository.Get(), "ReservationID", "ReservationID");

            ResortLocation resortLocation = uow.ResortRepository.Find(id);

            if (resortLocation == null)
            {
                return(HttpNotFound());
            }
            return(View(resortLocation));
        }