public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Tecnico).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TecnicoExists(Tecnico.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Tecnico.Add(Tecnico); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } Tecnico = await _context.Tecnico.FindAsync(id); if (Tecnico != null) { _context.Tecnico.Remove(Tecnico); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } ApplicationUser = await _context.Users.FindAsync(id); if (ApplicationUser != null) { _context.Users.Remove(ApplicationUser); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }