public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surename,Patronymic,Birthday,DateInput,ProtectionDate,Protection,Course,StatustypeId")] Aspirant aspirant) { if (id != aspirant.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(aspirant); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AspirantExists(aspirant.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StatustypeId"] = new SelectList(_context.Statuses, "Id", "Name", aspirant.StatustypeId); return(View(aspirant)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Code,Name,KnowledgeId")] Speciality speciality) { if (id != speciality.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(speciality); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpecialityExists(speciality.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["KnowledgeId"] = new SelectList(_context.Knowledges, "Id", "Name", speciality.KnowledgeId); // Custom return(View(speciality)); }