Beispiel #1
0
        public async Task <ActionResult <Todo.Todo> > Post([FromBody] Todo.Todo todo)
        {
            todo.Id = await _repo.GetNextId();

            await _repo.Create(todo);

            return(new OkObjectResult(todo));
        }
Beispiel #2
0
        public async Task <ActionResult <Todo.Todo> > Put(long id, [FromBody] Todo.Todo todo)
        {
            var todoFromDb = await _repo.GetTodo(id);

            if (todoFromDb == null)
            {
                return(new NotFoundResult());
            }

            todo.Id         = todoFromDb.Id;
            todo.InternalId = todoFromDb.InternalId;

            await _repo.Update(todo);

            return(new OkObjectResult(todo));
        }