public ActionResult Delete(int id, studentnew std1) { try { std1 = db.studentnews.Find(id); db.studentnews.Remove(std1); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(studentnew std1) { try { if (ModelState.IsValid) { db.studentnews.Add(std1); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(std1)); } catch { return(View()); } }
public ActionResult Edit(int id, studentnew std1) { try { // TODO: Add update logic here if (ModelState.IsValid) { db.Entry(std1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(std1)); } catch { return(View()); } }