public IActionResult Add([FromBodyAttribute] TodoItem item) { if (item == null) { return(BadRequest()); } if (item.ID == null) { item.ID = Guid.NewGuid().ToString(); } _logger.LogInformation(item.Name); if (ModelState.IsValid) { _repository.Add(item); _repository.CommitChanges(); return(Ok(item)); } else { return(BadRequest()); } }