Exemple #1
0
        public async Task <IActionResult> PutTodo(int id, Todos todo)
        {
            if (id != todo.Id)
            {
                return(BadRequest());
            }

            _context.Entry(todo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TodoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }