Exemplo n.º 1
0
 public HistoryItem GetHistoryItem()
 {
     return(new HistoryItem
     {
         Filename = FileName,
         Filepath = FilePath,
         DateTimeUtc = UploadTime,
         Type = UploadDestination.ToString(),
         Host = UploaderHost,
         URL = Result.URL,
         ThumbnailURL = Result.ThumbnailURL,
         DeletionURL = Result.DeletionURL,
         ShortenedURL = Result.ShortenedURL
     });
 }
        public async Task <JsonNetResult> GenerateUploadDestination(GenerateUploadDestinationViewModel model)
        {
            // Generate a destination for the upload
            UploadDestination uploadDestination = await _uploads.GenerateUploadDestination(new GenerateUploadDestination { FileName = model.FileName });

            if (uploadDestination.ErrorMessage != null)
            {
                ModelState.AddModelError(string.Empty, uploadDestination.ErrorMessage);
                return(JsonFailure());
            }

            // Return the Id and the URL where the file can be uploaded
            return(JsonSuccess(new UploadDestinationViewModel
            {
                UploadUrl = uploadDestination.UploadUrl
            }));
        }