// Editing student public async Task <IActionResult> OnPost() { if (!ModelState.IsValid) { return(Page()); } var student = _db.Students.Find(Student.Id); if (student != null) { student.FirstName = Student.FirstName; student.LastName = Student.LastName; student.PhoneNumber = Student.PhoneNumber; student.ImageName = Student.ImageName; _db.Update(student); await _db.SaveChangesAsync(); } return(RedirectToPage("View")); }