예제 #1
0
        public JsonResult CreateCategory(string name, long pId)
        {
            if (string.IsNullOrWhiteSpace(name) || name.Length > 12)
            {
                throw new Exception("分类名称长度不能多于12位");
            }



            var cate = new Entities.ShopCategoryInfo
            {
                Name             = name,
                ParentCategoryId = pId,
                IsShow           = true,
                DisplaySequence  = _iShopCategoryService.GetCategoryByParentId(pId).Count() + 1,
                ShopId           = CurrentSellerManager.ShopId
            };

            _iShopCategoryService.AddCategory(cate);
            // ServiceApplication.Create<IOperationLogService>().AddSellerOperationLog(
            //new LogInfo
            //{
            //    Date = DateTime.Now,
            //    Description = "创建店铺分类,父Id=" + pId,
            //    IPAddress = Request.UserHostAddress,
            //    PageUrl = "/Category/CreateCategory",
            //    UserName = CurrentSellerManager.UserName,
            //    ShopId = CurrentSellerManager.ShopId
            //});
            return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
 public ShopCategoryModel(Entities.ShopCategoryInfo info)
     : this()
 {
     this.Id = info.Id;
     this.DisplaySequence  = info.DisplaySequence;
     this.IsShow           = info.IsShow;
     this.Name             = info.Name;
     this.ParentCategoryId = info.ParentCategoryId;
     this.ShopId           = info.ShopId;
     this.Depth            = info.ParentCategoryId != 0 ? 2 : 1;
 }