public IList <WallPaperCategoryView> GetCategoryViewList(MobileParam mobileParams, int cver, out int sver)
        {
            var categorylist = new WallPaperCategory().ReturnThemeInstance <WallPaperCategory>(cver, out sver);

            categorylist.GetCompleteInstance <WallPaperCategory>();
            return(categorylist.To <IList <WallPaperCategoryView> >());
        }
Exemple #2
0
        public IList <WallPaperCategoryView> GetCategoryViewList(MobileParam mobileParams, int cver, out int sver)
        {
            #region instance

            var cate0 = new WallPaperCategory()
            {
                Id              = 0,
                Name            = "全部",
                CategoryLogoUrl = "",
                Summary         = string.Empty,
                OrderNumber     = 0,
                CreateDateTime  = DateTime.Now,
                Comment         = "",
                Status          = 1
            };

            var cate1 = new WallPaperCategory()
            {
                Id              = 1,
                Name            = "美女",
                CategoryLogoUrl = "http://theme.kk874.com/ThemeResources/Thumbnails/th1123.jpg",
                Summary         = string.Empty,
                OrderNumber     = 1,
                CreateDateTime  = DateTime.Now,
                Comment         = "",
                Status          = 1
            };

            var cate2 = new WallPaperCategory()
            {
                Id              = 2,
                Name            = "动漫",
                CategoryLogoUrl = "http://theme.kk874.com/ThemeResources/Thumbnails/th1111.jpg",
                Summary         = string.Empty,
                OrderNumber     = 2,
                CreateDateTime  = DateTime.Now,
                Comment         = "",
                Status          = 1
            };
            #endregion

            var categorylist = new List <WallPaperCategory>()
            {
                cate0, cate1, cate2
            };

            var result = categorylist.To <IList <WallPaperCategoryView> >();

            sver = 1;
            return(result);
        }
Exemple #3
0
        public ActionResult CategoryEdit(WallPaperCategory model, HttpPostedFileBase logoFile)
        {
            var category = dbContextService.Single <WallPaperCategory>(model.Id);

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

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

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

            dbContextService.Update <WallPaperCategory>(category);
            WallPaperUIService.UpdateServerVersion <WallPaperCategory>();

            return(RedirectToAction("CategoryList"));
        }
Exemple #4
0
        public ActionResult CategoryAdd(WallPaperCategory model)
        {
            var exist = dbContextService.Exists <WallPaperCategory>(x => x.Name == model.Name);

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

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

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

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

            WallPaperUIService.UpdateServerVersion <WallPaperCategory>();

            return(RedirectToAction("CategoryList"));
        }