public async Task Put(int id, Todo todo) { var oldTodo = await Get(id); oldTodo.Task = todo.Task; oldTodo.IsCompleted = todo.IsCompleted; await _ctx.SaveChangesAsync(); }
public async Task<HttpResponseMessage> Post(Todo todo) { _ctx.Todos.Add(todo); await _ctx.SaveChangesAsync(); return Request.CreateResponse(HttpStatusCode.Created); }