public async Task <IActionResult> Edit(int id, [Bind("TeacherStructKafPostStavkaId,TeacherId,StructKafId,PostId,StavkaDate,Stavka,EmploymentFormId")] TeacherStructKafPostStavka teacherStructKafPostStavka) { if (id != teacherStructKafPostStavka.TeacherStructKafPostStavkaId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teacherStructKafPostStavka); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeacherStructKafPostStavkaExists(teacherStructKafPostStavka.TeacherStructKafPostStavkaId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PostId"] = new SelectList(_context.Posts, "PostId", "PostName", teacherStructKafPostStavka.PostId); ViewData["StructKafId"] = new SelectList(_context.StructKafs.Include(sk => sk.StructSubvision), "StructKafId", "StructSubvision.StructSubvisionName", teacherStructKafPostStavka.StructKafId); ViewData["TeacherId"] = new SelectList(_context.Teachers, "TeacherId", "TeacherFio", teacherStructKafPostStavka.TeacherId); ViewData["EmploymentForms"] = new SelectList(_context.EmploymentForms, "EmploymentFormId", "EmploymentFormName", teacherStructKafPostStavka.EmploymentFormId); return(View(teacherStructKafPostStavka)); }
public async Task <IActionResult> Create([Bind("TeacherStructKafPostStavkaId,TeacherId,StructKafId,PostId,StavkaDate,Stavka,EmploymentFormId")] TeacherStructKafPostStavka teacherStructKafPostStavka) { if (ModelState.IsValid) { _context.Add(teacherStructKafPostStavka); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PostId"] = new SelectList(_context.Posts, "PostId", "PostName", teacherStructKafPostStavka.PostId); ViewData["StructKafId"] = new SelectList(_context.StructKafs.Include(sk => sk.StructSubvision), "StructKafId", "StructSubvision.StructSubvisionName", teacherStructKafPostStavka.StructKafId); ViewData["TeacherId"] = new SelectList(_context.Teachers, "TeacherId", "TeacherFio", teacherStructKafPostStavka.TeacherId); ViewData["EmploymentForms"] = new SelectList(_context.EmploymentForms, "EmploymentFormId", "EmploymentFormName", teacherStructKafPostStavka.EmploymentFormId); return(View(teacherStructKafPostStavka)); }