public async Task <IActionResult> Edit(int id, [Bind("ModuleId,PartId,Header,Description,ContentUrl")] PartModules partModules) { if (id != partModules.ModuleId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(partModules); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PartModulesExists(partModules.ModuleId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PartId"] = new SelectList(_context.Parts, "PartId", "PartId", partModules.PartId); return(View(partModules)); }
public async Task <IActionResult> Create([Bind("ModuleId,PartId,Header,Description,ContentUrl")] PartModules partModules) { if (ModelState.IsValid) { _context.Add(partModules); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), new { id = partModules.PartId })); } ViewData["PartId"] = new SelectList(_context.Parts, "PartId", "PartId", partModules.PartId); return(View(partModules)); }