public ActionResult DeleteConfirmed(int id) { HotDogUser hotDogUser = db.HotDogUsers.Find(id); db.HotDogUsers.Remove(hotDogUser); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: HotDogUsers/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HotDogUser hotDogUser = db.HotDogUsers.Find(id); if (hotDogUser == null) { return(HttpNotFound()); } return(View(hotDogUser)); }
public ActionResult Edit([Bind(Include = "Id,UserName,Bio,FavoriteDog,PastDog")] HotDogUser hotDogUser) { IEnumerable <SelectListItem> pastdogs = db.PastDogs .Select(d => new SelectListItem { Value = d.Id.ToString(), Text = d.DogName }); ViewBag.PastDogs = pastdogs; if (ModelState.IsValid) { db.Entry(hotDogUser).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hotDogUser)); }