コード例 #1
0
        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)));
        }
コード例 #2
0
 public void Update <T>(T entity) where T : class
 {
     _context.Update(entity);
 }