コード例 #1
0
        public ActionResult JsonEditCatalog()
        {
            if (!HasAdminPrivilege())
            {
                return RedirectToAction("Logon", "Account", new { ReturnUrl = Request.Url.PathAndQuery });
            }
             var catId = Request["catId"];
            var models = CatalogsServices.GetCatalogItemList(catId);
            var catalogPostModel=new CatalogPostModel
                                     {
                                         Key =models.Key,
                                         Comment = models.Comment,
                                         StartDate = models.StartDate,
                                         EndDate = models.EndDate,
                                         Description = models.Description,
                                         DisplayTumbnail = models.DisplayTumbnail,
                                         SortSquence = models.SortSquence,
                                         Webcolumn = models.Webcolumn,
                                         AdminCatalogItemViewModel =(from item in models.AdminCatalogItemModels select new AdminCatalogItemViewModel
                                                                         {
                                                                               Mod = item.Mod,
                                                                               Price = item.Price,
                                                                               SalesPrice = item.SalesPrice,
                                                                               Sku = item.Sku,
                                                                                Title = item.Title
                                                                         })
                                     };
            Session["EditCatalogItems"] = models.AdminCatalogItemModels.ToList();

            return PartialView("EditorTemplates/Admin/AddCatalogs",catalogPostModel);
        }
コード例 #2
0
        public ActionResult JsonCreateCatalog(CatalogPostModel postModel)
        {
            if (ModelState.IsValid)
            {

                if (string.IsNullOrEmpty(postModel.Key))
                {
                    var lstCatalogsModels = CatalogsServices.CreateNewCatalog(true, "", postModel.Description,
                                                                              postModel.StartDate, postModel.EndDate,
                                                                              postModel.DisplayTumbnail.ToString(
                                                                                  CultureInfo.InvariantCulture),
                                                                              postModel.Comment, postModel.Webcolumn,
                                                                              postModel.SortSquence,
                                                                              DZoft.dBug.TCS.DL.PickBase.openMode.Add);
                }
                else
                {
                    var lstCatalogsModels = CatalogsServices.CreateNewCatalog(false, postModel.Key,
                                                                              postModel.Description,
                                                                              postModel.StartDate, postModel.EndDate,
                                                                              postModel.DisplayTumbnail.ToString(
                                                                                  CultureInfo.InvariantCulture),
                                                                              postModel.Comment, postModel.Webcolumn,
                                                                              postModel.SortSquence,
                                                                              DZoft.dBug.TCS.DL.PickBase.openMode.Update);
                }
                return Json(new {success = true});
            }
            return Json(new {success = false});
        }