public async Task <IActionResult> Edit(int id, [Bind("EduOPYearId,EduProfileId,IsOVZ,EduYearBeginningTrainingId,EduOPEduYearNameId,VOchn,VOchnZaochn,VZaochn")] EduOPYear eduOPYear) { if (id != eduOPYear.EduOPYearId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(eduOPYear); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EduOPYearExists(eduOPYear.EduOPYearId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EduOPEduYearNameId"] = new SelectList(_context.EduOPEduYearNames, "EduOPEduYearNameId", "EduOPEduYearNameName", eduOPYear.EduOPEduYearNameId); ViewData["EduProfileId"] = new SelectList(_context.EduProfiles.Include(p => p.EduNapravl.EduUgs.EduLevel), "EduProfileId", "GetEduProfileFullName", eduOPYear.EduProfileId); ViewData["EduYearBeginningTrainingId"] = new SelectList(_context.EduYearBeginningTrainings, "EduYearBeginningTrainingId", "EduYearBeginningTrainingName", eduOPYear.EduYearBeginningTrainingId); return(View(eduOPYear)); }
public async Task <IActionResult> Create([Bind("EduOPYearId,EduProfileId,IsOVZ,EduYearBeginningTrainingId,EduOPEduYearNameId,VOchn,VOchnZaochn,VZaochn")] EduOPYear eduOPYear) { if (ModelState.IsValid) { _context.Add(eduOPYear); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EduOPEduYearNameId"] = new SelectList(_context.EduOPEduYearNames, "EduOPEduYearNameId", "EduOPEduYearNameName", eduOPYear.EduOPEduYearNameId); ViewData["EduProfileId"] = new SelectList(_context.EduProfiles.Include(p => p.EduNapravl.EduUgs.EduLevel), "EduProfileId", "GetEduProfileFullName", eduOPYear.EduProfileId); ViewData["EduYearBeginningTrainingId"] = new SelectList(_context.EduYearBeginningTrainings, "EduYearBeginningTrainingId", "EduYearBeginningTrainingName", eduOPYear.EduYearBeginningTrainingId); return(View(eduOPYear)); }