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

            db.naturePlaces.Remove(naturePlace);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,placeName,address,imagePicture,url,sportSuggestions,Tag,Detail")] naturePlace naturePlace)
 {
     if (ModelState.IsValid)
     {
         db.Entry(naturePlace).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(naturePlace));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "Id,placeName,address,imagePicture,url,sportSuggestions,Tag,Detail")] naturePlace naturePlace)
        {
            if (ModelState.IsValid)
            {
                db.naturePlaces.Add(naturePlace);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(naturePlace));
        }
コード例 #4
0
        // GET: naturePlaces/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            naturePlace naturePlace = db.naturePlaces.Find(id);

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