Exemplo n.º 1
0
        public IList <WallPaperSubCategoryView> GetSubCategoryViewList(MobileParam mobileParams, int cver, out int sver)
        {
            #region instance
            var subcate1 = new WallPaperSubCategory()
            {
                Id                 = 1,
                Name               = "美女之家",
                CategoryId         = 1,
                SubCategoryLogoUrl = "http://theme.kk874.com/ThemeResources/Thumbnails/th1123.jpg",
                Summary            = string.Empty,
                OrderNumber        = 1,
                CreateDateTime     = DateTime.Now,
                Comment            = "",
                Status             = 1
            };

            var subcate2 = new WallPaperSubCategory()
            {
                Id                 = 2,
                Name               = "模特",
                CategoryId         = 1,
                SubCategoryLogoUrl = "http://theme.kk874.com/ThemeResources/Thumbnails/th1124.jpg",
                Summary            = string.Empty,
                OrderNumber        = 3,
                CreateDateTime     = DateTime.Now,
                Comment            = "",
                Status             = 1
            };

            var subcate3 = new WallPaperSubCategory()
            {
                Id                 = 3,
                Name               = "动漫1",
                CategoryId         = 2,
                SubCategoryLogoUrl = "http://theme.kk874.com/ThemeResources/Thumbnails/th1112.jpg",
                Summary            = string.Empty,
                OrderNumber        = 2,
                CreateDateTime     = DateTime.Now,
                Comment            = "",
                Status             = 1
            };
            #endregion

            var subcategorylist = new List <WallPaperSubCategory>()
            {
                subcate1, subcate2, subcate3
            };

            var result = subcategorylist.To <IList <WallPaperSubCategoryView> >();

            sver = 1;
            return(result);
        }
Exemplo n.º 2
0
        public ActionResult SubCategoryEdit(WallPaperSubCategory model, HttpPostedFileBase logoFile)
        {
            var subcategory = dbContextService.Single <WallPaperSubCategory>(model.Id);

            subcategory.Name           = model.Name;
            subcategory.Status         = model.Status;
            subcategory.OrderNumber    = model.OrderNumber;
            subcategory.Comment        = model.Comment;
            subcategory.CreateDateTime = DateTime.Now;

            var logoFilePath = GetThemeLogoFilePath <WallPaperSubCategory>(model, logoFile);

            if (!string.IsNullOrEmpty(logoFilePath))
            {
                subcategory.SubCategoryLogoUrl = string.Format("{0}{1}", THEME_LOGO_IMAGE_PREFIX, Path.GetFileName(logoFilePath));
            }

            dbContextService.Update <WallPaperSubCategory>(subcategory);
            WallPaperUIService.UpdateServerVersion <WallPaperSubCategory>();

            return(RedirectToAction("SubCategoryList"));
        }
Exemplo n.º 3
0
        public ActionResult SubCategoryAdd(WallPaperSubCategory model)
        {
            var exist = dbContextService.Exists <WallPaperSubCategory>(x => x.Name == model.Name);

            if (exist)
            {
                TempData["errorMsg"] = "该分类已经存在!";
                return(View());
            }

            var logoFile     = Request.Files[Request.Files.Keys.Count - 1];
            var logoFilePath = GetThemeLogoFilePath <WallPaperSubCategory>(model, logoFile);

            if (!string.IsNullOrEmpty(logoFilePath))
            {
                model.SubCategoryLogoUrl = string.Format("{0}{1}", THEME_LOGO_IMAGE_PREFIX, Path.GetFileName(logoFilePath));
            }

            var ret = dbContextService.Add <WallPaperSubCategory>(model);

            WallPaperUIService.UpdateServerVersion <WallPaperSubCategory>();

            return(RedirectToAction("SubCategoryList"));
        }
Exemplo n.º 4
0
        public IList <WallPaperSubCategoryView> GetSubCategoryViewList(MobileParam mobileParams, int cver, out int sver)
        {
            var subcategorylist = new WallPaperSubCategory().ReturnThemeInstance <WallPaperSubCategory>(cver, out sver);

            return(subcategorylist.To <IList <WallPaperSubCategoryView> >());
        }