public ActionResult Edit(int rollno) { bool isloggedin = Convert.ToBoolean(Session["Isloggedin"]); if (!isloggedin) { return(RedirectToAction("Index", "Login")); } EditViewModel vm = new EditViewModel(); var student = _service.GetStudentByRollno(rollno); if (student != null) { vm.StudentRollno = student.Rollno.ToString(); vm.StudentName = student.Name; vm.StudentDOB = student.Birthdate.ToString(); vm.StudentCGPA = student.CGPA.ToString(); vm.StudentLocation = student.Location; } return(View(vm)); }