public ActionResult DeleteConfirmed(int id, string want) { SpeciesWant speciesWant = db.SpeciesWants .SingleOrDefault(x => x.SpeciesId == id && x.Want == want); db.SpeciesWants.Remove(speciesWant); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "SpeciesId,Want,Amount,Tag")] SpeciesWant speciesWant) { if (ModelState.IsValid) { db.SpeciesWants.Add(speciesWant); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SpeciesId = new SelectList(db.Species, "Id", "Name", speciesWant.SpeciesId); return(View(speciesWant)); }
// GET: SpeciesWants/Delete/5 public ActionResult Delete(int?id, string want) { if (id == null || want == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SpeciesWant speciesWant = db.SpeciesWants .SingleOrDefault(x => x.SpeciesId == id && x.Want == want); if (speciesWant == null) { return(HttpNotFound()); } return(View(speciesWant)); }