コード例 #1
0
        private IActionResult GetFileBestFit(string fileId, int width, int height)
        {
            if (!Guid.TryParse(fileId, out Guid id))
            {
                return(BadRequest("Invalid file id"));
            }

            var alt = _fileData.GetBestFileAlternate(id, width, height);

            if (alt != null)
            {
                return(File(alt.FileBlob, alt.Metadata.ContentType));
            }

            var file = _fileData.GetFile(id);

            if (file == null)
            {
                return(BadRequest("File not found."));
            }

            return(GetFileFullContent(file, width, height));
        }