public async Task <IActionResult> Edit(Guid id, [Bind("Name,Id")] ItType itType) { if (id != itType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(itType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItTypeExists(itType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(itType)); }
public async Task <IActionResult> Create([Bind("Name,Id")] ItType itType) { if (ModelState.IsValid) { itType.Id = Guid.NewGuid(); _context.Add(itType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(itType)); }