public async Task <IActionResult> Edit(int id, [Bind("EduAccredId,EduAccredNumber,EduAccredDate,EduAccredDateExpiration,EduAccredFileId")] EduAccred eduAccred) { if (id != eduAccred.EduAccredId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(eduAccred); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EduAccredExists(eduAccred.EduAccredId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EduAccredFileId"] = new SelectList(_context.Files, "Id", "Id", eduAccred.EduAccredFileId); return(View(eduAccred)); }
public async Task <IActionResult> Create([Bind("EduAccredId,EduAccredNumber,EduAccredDate,EduAccredDateExpiration,EduAccredFileId")] EduAccred eduAccred) { if (ModelState.IsValid) { _context.Add(eduAccred); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EduAccredFileId"] = new SelectList(_context.Files, "Id", "Id", eduAccred.EduAccredFileId); return(View(eduAccred)); }