public ActionResult Create(papertable paper) { try { // TODO: Add insert logic here using (aptadbEntities aptadb = new aptadbEntities()) { aptadb.papertable.Add(paper); aptadb.SaveChanges(); //return View(aptadb.authortable.ToList()); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int?id, papertable paper) { try { // TODO: Add update logic here using (aptadbEntities aptadb = new aptadbEntities()) { //return View(aptadb.authortable.Where(x => x.authorid == id).FirstOrDefault()); aptadb.Entry(paper).State = EntityState.Modified; aptadb.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here using (aptadbEntities aptadb = new aptadbEntities()) { //aptadb.authortable.Add(author); papertable ppertable = aptadb.papertable.Where(x => x.paperid == id).FirstOrDefault(); aptadb.papertable.Remove(ppertable); aptadb.SaveChanges(); //return View(aptadb.authortable.ToList()); } return(RedirectToAction("Index")); } catch { return(View()); } }