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

            // delete the image
            try
            {
                await ImagesService.DeleteImageNoteAsync(id, userId);

                return(new NoContentResult());
            }
            catch (Exception ex)
            {
                log.Error("Unhandled exception", ex);
                return(new ExceptionResult(ex, false));
            }
        }