public IActionResult AddEngArtStudent(EngArtStudent s) { if (ModelState.IsValid) { EngArtStudent t = new EngArtStudent(); 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.EngArtStudent.Add(t); db.SaveChanges(); } return(Redirect("ViewEngArtStudentList")); }
public IActionResult ViewEngArtStudentList() { var test = db.EngArtStudent; var i = new List <EngArtStudent>(); foreach (var s in test) { EngArtStudent t = new EngArtStudent(); 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)); }