private void ImportCategory(ImportPageModel model) { // import the category int startingCategoryId = model.CategoryId; int startingContentNodeId = model.ParentNodeId; UCategoryService.ProcessCategory(startingContentNodeId, startingCategoryId, model.DeepImport, true, model.Test3Only); }
private void ImportProduct(ImportPageModel model) { // load up hard-coded product UProduct testProduct = UProductRepository.Load(2951); Guid mGuid = MProductService.MakeMerchelloProduct(testProduct); UProductService.MakeProduct(testProduct, model.ParentNodeId, mGuid); }
public ActionResult ImportPageView() { var current = Umbraco.TypedContent(UmbracoContext.PageId); var home = current.AncestorOrSelf(1); ImportPageModel model = new ImportPageModel(); model.ContentNodes = new SelectList(home.Descendants("ProductListing"), "Id", "Name"); model.CategoryId = 12; model.Categories = UCategoryService.GetCategoryListItems(); //model.ContentNodes = GetNodes("ProductListing"); return(this.PartialView("~/Views/Partials/ImportPageView.cshtml", model)); }
public ActionResult ImportPage(string submitButton, ImportPageModel model) { //model not valid, do not save, but return current umbraco page if (!ModelState.IsValid) { //Perhaps you might want to add a custom message to the ViewBag //which will be available on the View when it renders (since we're not //redirecting) return(CurrentUmbracoPage()); } // process which button was pressed switch (submitButton) { case "Import Products": ImportProduct(model); break; case "Import Category with Products": // make sure catgory is valid if (model.CategoryId == 0 || model.ParentNodeId == 0) { // invalid category selection ViewBag.Status = "You must select a category and parent node!"; return(CurrentUmbracoPage()); } ImportCategory(model); break; case "Import Reviews": UProductReviewService.ImportReviews(); break; case "Delete Reviews Table": UProductReviewService.DeleteLegacyTable(); break; case "Delete Mappings Table": UProductMappingService.DeleteLegacyTable(); break; case "Delete Merchello Products": MProductService.DeleteProducts(); break; } //redirect to current page to clear the form ViewBag.Status = "Import completed."; return(RedirectToCurrentUmbracoPage()); }
public async Task <ActionResult> ImportPage(HttpPostedFileBase __filename, ImportPageModel model) #endif { FileUpload upload = new FileUpload(); string tempName = await upload.StoreTempPackageFileAsync(__filename); List <string> errorList = new List <string>(); PageDefinition.ImportInfo info = await PageDefinition.ImportAsync(tempName, errorList); await FileSystem.TempFileSystemProvider.DeleteFileAsync(tempName); string errs = ""; if (errorList.Count > 0) { ScriptBuilder sbErr = new ScriptBuilder(); sbErr.Append(errorList, LeadingNL: true); errs = sbErr.ToString(); } if (info.Success) { string msg = this.__ResStr("imported", "\"{0}\" successfully imported(+nl)", __filename.FileName) + errs; UploadResponse resp = new UploadResponse { Result = $"$YetaWF.confirm('{Utility.JserEncode(msg)}', null, function() {{ window.location.assign('{Utility.JserEncode(info.Url)}'); }} );", }; return(new YJsonResult { Data = resp }); } else { // Anything else is a failure throw new Error(this.__ResStr("cantImport", "Can't import {0}:(+nl)", __filename.FileName) + errs); } }
public async Task <ActionResult> ImportPage(IFormFile __filename, ImportPageModel model)
public ActionResult ImportPageView(string submitButton, ImportPageModel model) { return(RedirectToCurrentUmbracoPage()); }