public async Task <IActionResult> Edit(int id, JobTitleViewModel jobTitle) { if (id != jobTitle.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(jobTitle.GetModel()); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobTitleExists(jobTitle.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } jobTitle.loadLists(_context); return(View(jobTitle)); }
public async Task <IActionResult> Create(JobTitleViewModel jobTitle) { if (ModelState.IsValid) { _context.Add(jobTitle.GetModel()); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } jobTitle.loadLists(_context); return(View(jobTitle)); }