public IActionResult create(CourseCreateViewModels model) { if (ModelState.IsValid) { var course = new Course(); course.Name = model.Name; course.AuthorId = model.AuthorId; course = _repositoryCourse.add(course); return(RedirectToAction(nameof(details), new { course.id })); } else { var course = new CourseCreateViewModels(); course.authorsList = _repositoryCourse.SelectListItemAuthor(); return(View(course)); } }