public ActionResult CreateCourse() { var courseCategory = new CategoryCourseModel() { Categories = _context.Categories.ToList(), }; return(View(courseCategory)); }
public ActionResult CreateCourse(CategoryCourseModel categoryCourseModel) { var new_course = new Course() { Name = categoryCourseModel.Course.Name, Category_Id = categoryCourseModel.CategoryId }; _context.Courses.Add(new_course); _context.SaveChanges(); return(RedirectToAction("CourseManagement")); }