示例#1
0
 public static Todo ToTodo(this TodoTableEntity todoTableEntity)
 {
     return(new Todo
     {
         Id = todoTableEntity.RowKey,
         TaskDescription = todoTableEntity.TaskDescription,
         IsCompleted = todoTableEntity.IsCompleted,
         CreatedTime = todoTableEntity.CreatedTime
     });
 }
示例#2
0
        public static IActionResult GetTodoById(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "todo/{id}")] HttpRequest req,
            [Table("todos", "TODO", "{id}", Connection = "AzureWebJobsStorage")] TodoTableEntity todo,
            ILogger log, string id)
        {
            log.LogInformation("Getting todo item by id");

            if (todo == null)
            {
                log.LogInformation($"Item {id} not found");
                return(new NotFoundResult());
            }

            return(new OkObjectResult(todo));
        }