public async Task <IActionResult> Edit(int id, [Bind("ModuleId,Description,IsEnabled,CourseId,ModuleCode,Title,DateCreated,UserCreated,DateModified,UserModified")] AdmModules admModules) { if (id != admModules.ModuleId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(admModules); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AdmModulesExists(admModules.ModuleId)) { return(NotFound()); } else { throw; } } await Task.Delay(1500); return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.AdmCourses, "CourseId", "CourseTitle", admModules.CourseId); return(View(admModules)); }
public async Task <IActionResult> Create([Bind("ModuleId,Description,IsEnabled,CourseId,ModuleCode,Title,DateCreated,UserCreated,DateModified,UserModified")] AdmModules admModules) { if (ModelState.IsValid) { _context.Add(admModules); await _context.SaveChangesAsync(); await Task.Delay(1500); return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.AdmCourses, "CourseId", "CourseTitle", admModules.CourseId); return(View(admModules)); }