Exemple #1
0
        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);
        }
Exemple #2
0
        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());
        }