public ActionResult DeleteConfirmed(int id) { p_author p_author = db.p_author.Find(id); db.p_author.Remove(p_author); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "C_id,lname,fname,email")] p_author p_author) { if (ModelState.IsValid) { db.Entry(p_author).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(p_author)); }
public ActionResult Create([Bind(Include = "C_id,lname,fname,email")] p_author p_author) { if (ModelState.IsValid && !db.p_author.Where(item => item.fname == p_author.fname && item.lname == p_author.lname).Any()) { db.p_author.Add(p_author); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ErrorMessage = "This user already exists"; return(View(p_author)); }
// GET: p_author/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } p_author p_author = db.p_author.Find(id); if (p_author == null) { return(HttpNotFound()); } return(View(p_author)); }