public Todo Get(int id) { _logger.LogInformation($"Received GET Request for {id}"); TodoCounters.IncrementTodoGetRequests(); return(_todoservice.Get(id)); }
public IEnumerable <Todo> Get() { _logger.LogInformation("Received GET Request "); TodoCounters.IncrementTodoGetRequests(); return(_todoservice.Get().ToArray()); }
public IActionResult Create(Todo todo) { _logger.LogInformation("Received POST Request "); if (!ModelState.IsValid) { return(BadRequest("Invalid data.")); } TodoCounters.IncrementTodoPostRequests(); _todoservice.Create(todo); return(CreatedAtRoute("GetTask", new { id = todo.Id }, todo)); }
public IActionResult Update(Todo todo) { _logger.LogInformation("Received PUT Request "); if (!ModelState.IsValid) { return(BadRequest("Invalid data.")); } TodoCounters.IncrementTodoUpdateRequests(); _todoservice.Update(todo); return(Ok()); }