public override void Given() { BlobUniqueReference = Guid.NewGuid(); UploadSuccessfulViewModel = new UploadSuccessfulViewModel { Stats = new ViewModel.BulkUploadStatsViewModel { TotalRecordsCount = 1 } }; CacheService.GetAndRemoveAsync <UploadSuccessfulViewModel>(CacheKey).Returns(UploadSuccessfulViewModel); }
public override void Given() { BlobUniqueReference = Guid.NewGuid(); UploadSuccessfulViewModel = new UploadSuccessfulViewModel { Stats = new ViewModel.BulkUploadStatsViewModel { TotalRecordsCount = 3, NewRecordsCount = 1, AmendedRecordsCount = 1, UnchangedRecordsCount = 1 } }; CacheService.GetAndRemoveAsync <UploadSuccessfulViewModel>(Arg.Any <string>()).Returns(UploadSuccessfulViewModel); }
public async Task <IActionResult> UploadResultsFileAsync(UploadResultsRequestViewModel viewModel) { if (!ModelState.IsValid) { return(View(viewModel)); } viewModel.AoUkprn = User.GetUkPrn(); var response = await _resultLoader.ProcessBulkResultsAsync(viewModel); if (response.IsSuccess) { var successfulViewModel = new UploadSuccessfulViewModel { Stats = response.Stats }; await _cacheService.SetAsync(string.Concat(CacheKey, Constants.ResultsUploadSuccessfulViewModel), successfulViewModel, CacheExpiryTime.XSmall); return(RedirectToRoute(RouteConstants.ResultsUploadSuccessful)); } if (response.ShowProblemWithServicePage) { return(RedirectToRoute(RouteConstants.ProblemWithResultsUpload)); } var unsuccessfulViewModel = new UploadUnsuccessfulViewModel { BlobUniqueReference = response.BlobUniqueReference, FileSize = response.ErrorFileSize, FileType = FileType.Csv.ToString().ToUpperInvariant() }; await _cacheService.SetAsync(string.Concat(CacheKey, Constants.UploadUnsuccessfulViewModel), unsuccessfulViewModel, CacheExpiryTime.XSmall); return(RedirectToRoute(RouteConstants.ResultsUploadUnsuccessful)); }