public async Task <IActionResult> Edit(int id, [Bind("Id,ClassId,Name,StartTime,EndTime")] ClassStudy classStudy) { if (id != classStudy.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(classStudy); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClassStudyExists(classStudy.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(classStudy)); }
public async Task <IActionResult> Create([Bind("Id,ClassId,Name,StartTime,EndTime")] ClassStudy classStudy) { if (!ModelState.IsValid) { return(View("Create", classStudy)); } _context.Add(classStudy); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); return(View(classStudy)); }