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

            db.HobbyTables.Remove(hobbyTable);
            db.SaveChanges();
            //changed Index to Create on next line
            return(RedirectToAction("Create"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "HobbyID,PlaySports,InAShow,Travel,OutdoorPerson,TravelAbroad,Passions,Talents,Trophies,Exercise,FamilyVacation,ChildhoodVacation,AnythingElse")] HobbyTable hobbyTable)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hobbyTable).State = EntityState.Modified;
         db.SaveChanges();
         //next line changed from Index to Details, and id
         return(RedirectToAction("Details", new { id = hobbyTable.HobbyID }));
     }
     return(View(hobbyTable));
 }
コード例 #3
0
        // GET: HobbyTables/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HobbyTable hobbyTable = db.HobbyTables.Find(id);

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