public ActionResult Import(UserImportViewModel model) { IStorageServiceProvider storageService = null; if (model.StorageProvider == "azure") { storageService = new AzureBlobService(); } if (model.StorageProvider == "aws") { storageService = new AWSBlobService(); } if (storageService != null) { string myBucketName = System.Configuration.ConfigurationManager.AppSettings["ContainerBucketName"]; Tuple <string, string> resultUpload = storageService.UploadPublicFile(model.ImportedFile.InputStream, model.ImportedFile.FileName, myBucketName); model.FinalUrl = resultUpload.Item1; } return(View("Index", model)); }
public ActionResult Import(MonitorViewModel model) { IStorageServiceProvider storageService = null; if (model.StorageProvider == "azure") { storageService = new AzureBlobService(); } if (model.StorageProvider == "aws") { storageService = new AWSBlobService(); } if (storageService != null) { string myBucketName = System.Configuration.ConfigurationManager.AppSettings["ContainerBucketName"]; Tuple <string, string> resultUpload = storageService.UploadPublicFile(model.ImportedFile.InputStream, model.ImportedFile.FileName, myBucketName); model.FinalUrl = resultUpload.Item1; } HttpResponseMessage response = ProcessImageUrl(model.FinalUrl); IEnumerable <string> values; if (response.Headers.TryGetValues("Operation-Location", out values)) { model.FinalUrl = values.First(); } Thread.Sleep(3000); model.Content = ProcessResultUrl(model.FinalUrl); ResultMonitor result = JsonUtil.ConvertToObject <ResultMonitor>(model.Content); model.ResultMonitor = result; return(View("Index", model)); }