public IActionResult ExtractPackage(Hash packageId, ExtractPackageViewModel viewModel) { if (!ModelState.IsValid) { return(View()); } PackageOperationViewModel package; if ((package = facade.GetPackageOrNull(packageId)) == null) { return(NotFound()); } try { facade.ExtractPackage(package.Id, viewModel.Folder, viewModel.DoValidate); } catch (Exception e) { ModelState.AddModelError(string.Empty, e.Message); } return(RedirectToAction(nameof(Index))); }
public IActionResult ExtractPackage(Hash packageId) { if (!ModelState.IsValid) { return(BadRequest()); } PackageOperationViewModel package; if ((package = facade.GetPackageOrNull(packageId)) == null) { return(NotFound()); } var model = new ExtractPackageViewModel() { DoValidate = true, Folder = facade.RecommendFolderForExtraction(), Package = package }; return(View(model)); }