public IActionResult Edit(int Id, CoursesViewModel model) { if (Id != model.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _universityService.UpdateCourse(model); } catch (DbUpdateConcurrencyException) { if (!_universityService.CourseExists(model.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(model)); }