public IActionResult Create(string courseCode, int courseNumber, string courseName, string dayOfTheWeek1, string startTime, string stopTime) { //get id of currently logged in user var applicationUserId = _userManager.GetUserId(HttpContext.User); //create new a schedule and tie it to the currently logged in user var schedule = new Schedule { ApplicationUserId = applicationUserId }; //store the newly created schedule in the database _scheduleRepository.CreateSchedule(schedule); //create a new Course, DayOfTheWeek, and Time, fill them with the parameters passed in from the view (user input), and store them in the database _courseRepository.CreateCourse(new Course { CourseCode = courseCode, CourseNumber = courseNumber, CourseName = courseName, ScheduleId = schedule.Id }); _dayWeekRepository.Create(new DayOfTheWeek { DayOfTheWeek1 = dayOfTheWeek1, ScheduleId = schedule.Id }); _timeRepository.CreateTime(new Time { StartTime = startTime, StopTime = stopTime, ScheduleId = schedule.Id }); //redirect back to the schedul index return(RedirectToAction("Index", "Schedule")); }