public ActionResult Edit(int id, MVCSample.Models.Student std) { try { // TODO: Add update logic here Student selectedStudent = GetStudentById(id); selectedStudent.StudentName = std.StudentName; selectedStudent.Age = std.Age; return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(MVCSample.Models.Student std) { try { // TODO: Add insert logic here std.StudentId = ++MvcApplication.globalStudentId; MvcApplication.studentsList.Add(std); return(RedirectToAction("Index")); } catch { return(View()); } }