public static Registration ToRegistraion(
            this RegistrationTableEntity entity)
        {
            var registration = new Registration
            {
                Id         = entity.RowKey,
                Name       = entity.Name,
                Type       = entity.Type,
                FromMember = entity.FromMember,
                Start      = entity.Start,
                End        = DateTime.TryParse(entity.End, out DateTime date) ? date : default(DateTime?),
            };

            return(registration);
        }
        public static IActionResult GetTodoById(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "registration/{id}")] HttpRequest req,
            [Table("registration", PartitionKey, "{id}", Connection = "AzureWebJobsStorage")] RegistrationTableEntity 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.ToRegistraion()));
        }
        public static RegistrationTableEntity ToTableEntity(
            this Registration registration)
        {
            var entity = new RegistrationTableEntity
            {
                PartitionKey = "REGISTRATION",
                RowKey       = registration.Id,
                Name         = registration.Name,
                Type         = registration.Type,
                FromMember   = registration.FromMember,
                Start        = registration.Start,
                End          = registration.End?.ToString("yyyy-MM-ddTHH:mm:ss"),
            };

            return(entity);
        }