public async Task <IActionResult> Edit(Guid id, [Bind("Nome,Valor,Gratuito,Descricao,Data")] Evento evento) { if (id != evento.Id) { return(NotFound()); } if (!ModelState.IsValid) { return(View(evento)); } try { _context.Update(evento); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventoExists(evento.Id)) { return(NotFound()); } throw; } return(RedirectToAction(nameof(Index))); }
public void Update <T>(T entity) where T : class { _context.Update(entity); }