public static Tarefas ToTarefa(this TarefasTableEntity tarefa) { return(new Tarefas() { Id = tarefa.RowKey, DataCriacao = tarefa.DataCriacao, Finalizada = tarefa.Finalizada, NomeTarefa = tarefa.NomeTarefa }); }
public static IActionResult GetTarefaById( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "tarefa/{id}")] HttpRequest req, [Table("tarefas", "TAREFA", "{id}", Connection = "AzureWebJobsStorage")] TarefasTableEntity tarefa, TraceWriter log, string id) { log.Info("Pegando tarefa por id."); if (tarefa == null) { log.Info($"Tarefa {id} nao encontrada."); return(new NotFoundResult()); } return(new OkObjectResult(tarefa.ToTarefa())); }