public ActionResult DeleteConfirmed(int id) { Drugs drugs = db.Drugs.Find(id); db.Drugs.Remove(drugs); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "DrugId,DrugCode,Name,Company,ClassificationId")] Drugs drugs) { if (ModelState.IsValid) { db.Entry(drugs).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClassificationId = new SelectList(db.Classifications, "ClassificationId", "ClassificationCode", drugs.ClassificationId); return(View(drugs)); }
// GET: Drugs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Drugs drugs = db.Drugs.Find(id); if (drugs == null) { return(HttpNotFound()); } return(View(drugs)); }
// GET: Drugs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Drugs drugs = db.Drugs.Find(id); if (drugs == null) { return(HttpNotFound()); } ViewBag.ClassificationId = new SelectList(db.Classifications, "ClassificationId", "ClassificationCode", drugs.ClassificationId); return(View(drugs)); }