public ActionResult PostNewDate(ScheduleVM post) { if (post.STime != null || post.ETime != null) { using (var ctx = new CSEntities()) { // ctx.AddNewDate(post.STime, post.ETime, post.ClassList.FirstOrDefault(), post.CourseList.FirstOrDefault(), post.TeacherList.FirstOrDefault()); ctx.AddNewDate(post.STime, post.ETime, post.SelectedValuesCl.FirstOrDefault(), post.SelectedValuesC.FirstOrDefault(), post.SelectedValuesT.FirstOrDefault()); return(RedirectToAction("Schedule", "Home")); } } return(RedirectToAction("Schedule", "Home")); }