public ActionResult DeleteConfirmed(int id) { FanClubModel fanClubModel = db.FanClub.Find(id); db.FanClub.Remove(fanClubModel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,FirstName,LastName,Bday,gender,joinYear")] FanClubModel fanClubModel) { if (ModelState.IsValid) { db.Entry(fanClubModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fanClubModel)); }
public ActionResult Create([Bind(Include = "ID,FirstName,LastName,Bday,gender,joinYear")] FanClubModel fanClubModel) { if (ModelState.IsValid) { db.FanClub.Add(fanClubModel); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fanClubModel)); }
// GET: FanClub/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FanClubModel fanClubModel = db.FanClub.Find(id); if (fanClubModel == null) { return(HttpNotFound()); } return(View(fanClubModel)); }