コード例 #1
0
        public ActionResult Save(long id = 0)
        {
            Entities.TopicInfo topicInfo;

            if (id > 0)
            {
                topicInfo = TopicApplication.GetTopic(id);
                if (topicInfo.ShopId != CurrentSellerManager.ShopId)
                {
                    throw new HimallException("不存在该专题或者删除!" + id);
                }
            }
            else
            {
                topicInfo = new Entities.TopicInfo();
            }

            var modules  = TopicApplication.GetModules(id);
            var products = TopicApplication.GetModuleProducts(modules.Select(p => p.Id));

            var topicModel = new Models.TopicModel()
            {
                Id              = topicInfo.Id,
                Name            = topicInfo.Name,
                TopImage        = topicInfo.TopImage,
                TopicModuleInfo = modules,
                Products        = products,
                Tags            = topicInfo.Tags,
            };

            return(View(topicModel));
        }
コード例 #2
0
 public ActionResult Add(long?id)
 {
     if (id.HasValue)
     {
         var topicInfo  = TopicApplication.GetTopic(id.Value);
         var modules    = TopicApplication.GetModules(id.Value);
         var products   = TopicApplication.GetModuleProducts(modules.Select(p => p.Id));
         var topicModel = new Models.TopicModel()
         {
             BackgroundImage = topicInfo.BackgroundImage,
             Id              = topicInfo.Id,
             Name            = topicInfo.Name,
             TopImage        = topicInfo.TopImage,
             TopicModuleInfo = modules,
             ModuleProducts  = products,
             IsRecommend     = topicInfo.IsRecommend,
             SelfDefineText  = topicInfo.SelfDefineText
         };
         return(View(topicModel));
     }
     else
     {
         return(View(new Models.TopicModel()));
     }
 }
コード例 #3
0
ファイル: TopicController.cs プロジェクト: sky63886/Himall3.3
        // GET: Web/Topic
        public ActionResult Detail(long id)
        {
            var topic = TopicApplication.GetTopic(id);

            if (topic == null)
            {
                //404页面
            }
            var model = new TopicViewModel();

            model.Topic          = topic;
            model.Modules        = TopicApplication.GetModules(id);
            model.ModuleProducts = TopicApplication.GetModuleProducts(model.Modules.Select(p => p.Id));
            model.Products       = ProductManagerApplication.GetProducts(model.ModuleProducts.Select(p => p.ProductId));
            ViewBag.Keyword      = SiteSettings.Keyword;
            return(View(model));
        }
コード例 #4
0
ファイル: TopicController.cs プロジェクト: redpanda321/Mall
        public object LoadProducts(long topicId, long moduleId)
        {
            var topic    = TopicApplication.GetTopic(topicId);
            var module   = TopicApplication.GetModules(moduleId);
            var products = TopicApplication.GetModuleProducts(moduleId);
            var onSales  = ProductManagerApplication.GetOnSaleProducts(products.Select(p => p.ProductId).ToList());
            var model    = onSales.Select(item => new TopicModuleProductModel
            {
                Name        = item.ProductName,
                Id          = item.Id,
                Image       = item.GetImage(ImageSize.Size_350),
                Price       = item.MinSalePrice,
                MarketPrice = item.MarketPrice
            });
            dynamic result = SuccessResult();

            result.data = model.ToList();
            return(result);
        }
コード例 #5
0
ファイル: TopicController.cs プロジェクト: redpanda321/Mall
        public object GetTopicDetail(long id)
        {
            var topic             = TopicApplication.GetTopic(id);
            var modules           = TopicApplication.GetModules(id);
            var allModuleProducts = TopicApplication.GetModuleProducts(modules.Select(p => p.Id));
            var allOnSaleProducts = ProductManagerApplication.GetOnSaleProducts(allModuleProducts.Select(p => p.ProductId).ToList());

            TopicModel model = new TopicModel();

            model.Id          = topic.Id;
            model.Name        = topic.Name;
            model.TopImage    = MallIO.GetRomoteImagePath(topic.TopImage);
            model.TopicModule = new List <TopicModuleModel>();
            foreach (var module in modules)
            {
                var topicModuleModel = new TopicModuleModel();
                var moduleProducts   = allModuleProducts.Where(p => p.ModuleId == module.Id);
                topicModuleModel.Id   = module.Id;
                topicModuleModel.Name = module.Name;
                topicModuleModel.TopicModelProduct = allOnSaleProducts
                                                     .Where(p => moduleProducts.Select(x => x.ProductId).Contains(p.Id))
                                                     .Select(item => new TopicModuleProductModel
                {
                    Name        = item.ProductName,
                    Id          = item.Id,
                    Image       = Core.MallIO.GetRomoteProductSizeImage(item.RelativePath, 1, (int)Mall.CommonModel.ImageSize.Size_350),
                    Price       = item.MinSalePrice,
                    MarketPrice = item.MarketPrice
                }).ToList();

                model.TopicModule.Add(topicModuleModel);
            }
            dynamic result = SuccessResult();

            result.Topic = model;
            return(result);
        }
コード例 #6
0
        public JsonResult GetUserShippingAddressesList(long topicId, long moduleId, int page, int pageSize)
        {
            var topic    = TopicApplication.GetTopic(topicId);
            var module   = TopicApplication.GetModules(moduleId);
            var products = TopicApplication.GetModuleProducts(moduleId);
            var onSales  = ProductManagerApplication.GetOnSaleProducts(products.Select(p => p.ProductId).ToList())
                           .Skip(pageSize * (page - 1))
                           .Take(pageSize); //TODO:FG 数据分页 业务需要降层。

            var model = onSales.Select(item =>
            {
                var flashSaleModel = _iLimitTimeBuyService.GetFlaseSaleByProductId(item.Id);
                return(new
                {
                    name = item.ProductName,
                    id = item.Id,
                    image = item.GetImage(ImageSize.Size_350),
                    price = flashSaleModel != null ? flashSaleModel.MinPrice : item.MinSalePrice,
                    marketPrice = item.MarketPrice
                });
            });

            return(SuccessResult <dynamic>(data: model));
        }
コード例 #7
0
        public ActionResult Save(long id = 0)
        {
            var topic = new Entities.TopicInfo();

            if (id > 0)
            {
                topic = TopicApplication.GetTopic(id);
            }


            var modules    = TopicApplication.GetModules(id);
            var products   = TopicApplication.GetModuleProducts(modules.Select(p => p.Id));
            var topicModel = new Models.TopicModel()
            {
                Id              = topic.Id,
                Name            = topic.Name,
                TopImage        = topic.TopImage,
                TopicModuleInfo = modules,
                ModuleProducts  = products,
                Tags            = topic.Tags,
            };

            return(View(topicModel));
        }