// GET: SkillsProficiencies/Create public IActionResult Create() { SkillsProficiencyViewModel vm; vm = new SkillsProficiencyViewModel(_context); return(View(vm)); }
public async Task <IActionResult> Edit(int id, SkillsProficiencyViewModel skillsProficiency) { if (id != skillsProficiency.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(skillsProficiency.GetModel()); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SkillsProficiencyExists(skillsProficiency.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } skillsProficiency.loadLists(_context); return(View(skillsProficiency)); }
public async Task <IActionResult> Create(SkillsProficiencyViewModel skillsProficiency) { if (ModelState.IsValid) { _context.Add(skillsProficiency.GetModel()); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } skillsProficiency.loadLists(_context); return(View(skillsProficiency)); }
// GET: SkillsProficiencies/Edit/5 public async Task <IActionResult> Edit(int?id) { SkillsProficiencyViewModel vm; if (id == 0) { vm = new SkillsProficiencyViewModel(_context); } else { var skillsProficiency = await _context.SkillsProficiency.FindAsync(id); if (skillsProficiency == null) { return(NotFound()); } vm = new SkillsProficiencyViewModel(_context, skillsProficiency); } return(View(vm)); }