public ActionResult Add(StuffCommentCreateViewModel viewModel)
        {
            int userId;
            int.TryParse(TicketTool.GetUserData(), out userId);

            // 如无Category,创建新的
            if (viewModel.CategoryId == 0)
            {
                // 搜索
                var categories = StuffManager.SearchCategoryByName(viewModel.CategoryName.Trim());
                if (categories.Any(m => m.EnumDataEntityStatus == EnumDataEntityStatus.Normal))
                {
                    viewModel.CategoryId = categories.First(m => m.EnumDataEntityStatus == EnumDataEntityStatus.Normal).CategoryId;
                }
                else
                {
                    Category category = new Category();
                    //category.CategoryId
                    category.CreateTime = DateTime.Now;
                    category.CreateUser = userId;
                    category.Description = "";
                    category.EnumDataEntityStatus = EnumDataEntityStatus.Normal;
                    category.MergedId = 0;
                    category.Name = viewModel.CategoryName;
                    int categoryId = StuffManager.CreateCategory(category);
                    viewModel.CategoryId = categoryId;
                }


            }

            // 如无Brand,创建新的
            if (viewModel.BrandId == 0)
            {
                var brands = StuffManager.SearchBrandByName(viewModel.CategoryName.Trim());
                if (brands != null && brands.Any(m => m.EnumDataEntityStatus == EnumDataEntityStatus.Normal))
                {
                    viewModel.BrandId = brands.First(m => m.EnumDataEntityStatus == EnumDataEntityStatus.Normal).BrandId;
                }
                else
                {

                    Brand brand = new Brand();
                    brand.CreateTime = DateTime.Now;
                    brand.CreateUser = userId;
                    brand.Description = "";
                    brand.EnumDataEntityStatus = EnumDataEntityStatus.Normal;
                    brand.MergedId = 0;
                    brand.Name = viewModel.BrandName;
                    int brandId = StuffManager.CreateBrand(brand);
                    viewModel.BrandId = brandId;
                }


            }

            // 如无产品,创建新的
            if (viewModel.StuffId == 0)
            {
                var stuffs = StuffManager.SearchStuffByName(viewModel.StuffName);
                if (stuffs != null && stuffs.Any(m => m.EnumDataEntityStatus == EnumDataEntityStatus.Normal))
                {
                    viewModel.StuffId = stuffs.First(m => m.EnumDataEntityStatus == EnumDataEntityStatus.Normal).StuffId;
                }
                else
                {
                    Stuff stuff = new Stuff();
                    stuff.BrandId = viewModel.BrandId;
                    stuff.CategoryId = viewModel.CategoryId;
                    stuff.CraeteTime = DateTime.Now;
                    stuff.CreateUser = userId;
                    stuff.EnumDataEntityStatus = EnumDataEntityStatus.Normal;
                    stuff.MergedId = 0;
                    stuff.Name = viewModel.StuffName.Trim();
                    int stuffId =StuffManager.CreateStuff(stuff);
                    viewModel.StuffId = stuffId;

                }


            }

            // 创建评论
            StuffComment stuffComment = new StuffComment();

            stuffComment.BuyPrice = viewModel.BuyPrice;
            stuffComment.CommentDetail = viewModel.CommentDetail;
            stuffComment.CostPerformance = viewModel.CostPerformance;
            stuffComment.CrateTime = DateTime.Now;

            stuffComment.CreateUser = userId;
            stuffComment.EnumAuditStatus = EnumAuditStatus.Approved;
            stuffComment.Functions = viewModel.Functions;
            stuffComment.IsActive = true;
            // TODO:图片数据需要再处理
            stuffComment.Pictures = new List<string>();
            stuffComment.PublishTime = DateTime.Now;
            stuffComment.Published = true;
            stuffComment.Service = viewModel.Service;
            //stuffComment.StuffCommentId
            stuffComment.StuffId = viewModel.StuffId;
            stuffComment.Workmanship = viewModel.Workmanship;

            int stuffCommentId = StuffManager.CreateStuffComment(stuffComment);

            return View();
        }
 public ActionResult Publish(StuffCommentCreateViewModel viewModel)
 {
     return View();
 }
        public ActionResult Add()
        {
           StuffCommentCreateViewModel viewModel=new StuffCommentCreateViewModel();

           return View(viewModel);
        }