public async Task <IActionResult> Edit(int id, [Bind("Id,Descr,ReligionId,PoliticalPartiesMovementId")] RadicalOrganization radicalOrganization) { if (id != radicalOrganization.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(radicalOrganization); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RadicalOrganizationExists(radicalOrganization.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PoliticalPartiesMovementId"] = new SelectList(_context.PoliticalPartiesMovements, "Id", "Descr", radicalOrganization.PoliticalPartiesMovementId); ViewData["ReligionId"] = new SelectList(_context.Religions, "Id", "Descr", radicalOrganization.ReligionId); return(View(radicalOrganization)); }
public async Task <IActionResult> Create([Bind("Id,Descr,ReligionId,PoliticalPartiesMovementId")] RadicalOrganization radicalOrganization) { if (ModelState.IsValid) { _context.Add(radicalOrganization); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PoliticalPartiesMovementId"] = new SelectList(_context.PoliticalPartiesMovements, "Id", "Descr", radicalOrganization.PoliticalPartiesMovementId); ViewData["ReligionId"] = new SelectList(_context.Religions, "Id", "Descr", radicalOrganization.ReligionId); return(View(radicalOrganization)); }