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