public IActionResult EditEngSciStudent(EngSciStudent s) { if (ModelState.IsValid) { EngSciStudent t = new EngSciStudent(); t.StudentId = s.StudentId; t.StudentName = s.StudentName; t.Department = s.Department; t.PresentAddress = s.PresentAddress; t.PermanentAddress = s.PermanentAddress; t.Contact = s.Contact; t.Email = s.Email; db.EngSciStudent.Update(t); db.SaveChanges(); } return(RedirectToAction("ViewEngSciStudentList")); }
public IActionResult ViewEngSciStudentList() { var test = db.EngSciStudent; var i = new List <EngSciStudent>(); foreach (var s in test) { EngSciStudent t = new EngSciStudent(); t.StudentId = s.StudentId; t.StudentName = s.StudentName; t.Department = s.Department; t.PresentAddress = s.PresentAddress; t.PermanentAddress = s.PermanentAddress; t.Contact = s.Contact; t.Email = s.Email; i.Add(t); } return(View(i)); }