public async Task <IActionResult> Edit(int id, [Bind("Id,Day,StartTime,FinishTime,CourseClassId")] CourseClassDay courseClassDay) { if (id != courseClassDay.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(courseClassDay); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseClassDayExists(courseClassDay.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CourseClassId"] = new SelectList(_context.CourseClasses, "Id", "Id", courseClassDay.CourseClassId); return(View(courseClassDay)); }
public async Task <IActionResult> Create([Bind("Id,Day,StartTime,FinishTime,CourseClassId")] CourseClassDay courseClassDay) { if (ModelState.IsValid) { _context.Add(courseClassDay); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CourseClassId"] = new SelectList(_context.CourseClasses, "Id", "Id", courseClassDay.CourseClassId); return(View(courseClassDay)); }