Esempio n. 1
0
        public static async Task <IActionResult> BeginCreateImage
            ([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "images")] HttpRequest req,
            TraceWriter log)
        {
            // get the user ID
            if (!await UserAuthenticationService.GetUserIdAsync(req, out var userId, out var responseResult))
            {
                return(responseResult);
            }

            try
            {
                var(id, url) = ImagesService.BeginAddImageNote(userId);

                return(new OkObjectResult(new
                {
                    id = id,
                    url = url
                }));
            }
            catch (Exception ex)
            {
                log.Error("Unhandled exception", ex);
                return(new ExceptionResult(ex, false));
            }
        }