예제 #1
0
        public static Todo ToTodo(this TodoTableEntity entity)
        {
            var todo = new Todo {
                Id              = entity.RowKey,
                CreatedAt       = entity.CreatedAt,
                IsCompleted     = entity.IsCompleted,
                TaskDescription = entity.TaskDescription
            };

            return(todo);
        }
예제 #2
0
        public static TodoTableEntity ToTableEntity(this Todo todo)
        {
            var entity = new TodoTableEntity {
                PartitionKey    = "TODO",
                RowKey          = todo.Id,
                CreatedAt       = todo.CreatedAt,
                IsCompleted     = todo.IsCompleted,
                TaskDescription = todo.TaskDescription
            };

            return(entity);
        }
예제 #3
0
파일: TodoApi.cs 프로젝트: muehan/funcdemo
        public static IActionResult GetTodoById(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "todo/{id}")] HttpRequest req,
            [Table("todos", "TODO", "{id}", Connection = "AzureWebJobsStorage")] TodoTableEntity entity,
            ILogger log,
            string id)
        {
            log.LogInformation("Getting todo item by id");
            if (entity == null)
            {
                log.LogInformation($"item with id: {id} not found");
                return(new NotFoundResult());
            }

            return(new OkObjectResult(entity.ToTodo()));
        }