public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Categoria.CategoriaNome = Request.Form["Categoria.CategoriaNome"].ToString().ToUpper(); Categoria.LastUpdatedAt = DateTime.UtcNow.Date; Categoria.LastUpdatedBy = User.Identity.Name.ToString(); _context.Attach(Categoria).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoriaExists(Categoria.CategoriaId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }