public async Task <ActionResult <TodoItem> > CreateTodoItem(TodoItem todoItem) { _logger.LogInformation($"Creating new Todo item"); if (todoItem == null || string.IsNullOrWhiteSpace(todoItem.Name)) { return(new BadRequestResult()); } var table = TableStorageHelper.GetTableReference(_storageConnectionString, _tableName); var newTodoItem = new TodoItem { Name = todoItem.Name, IsCompleted = false }; // Create the InsertOrReplace table operation TableOperation insertOp = TableOperation.Insert(TodoItemMapper.ToEntity(newTodoItem)); // Execute the operation. TableResult result = await table.ExecuteAsync(insertOp); return(CreatedAtAction(nameof(GetTodoItem), new { id = newTodoItem.Id }, newTodoItem)); }