Exemplo n.º 1
0
        public ActionResult ExtraAppEdit(NewsExtraApp model, HttpPostedFileBase logoFile)
        {
            var extraApp = dbContextService.Single <NewsExtraApp>(model.Id);

            extraApp.Name           = model.Name;
            extraApp.PackageName    = model.PackageName;
            extraApp.VersionCode    = model.VersionCode;
            extraApp.ExtraType      = model.ExtraType;
            extraApp.IsBrower       = model.IsBrower;
            extraApp.ExtraLinkUrl   = model.ExtraLinkUrl;
            extraApp.ExtraLogoUrl   = model.ExtraLogoUrl;
            extraApp.Description    = model.Description;
            extraApp.Status         = model.Status;
            extraApp.CreateDateTime = DateTime.Now;

            var logoFilePath = GetNewsLogoFilePath <NewsExtraApp>(model, logoFile);

            if (!string.IsNullOrEmpty(logoFilePath))
            {
                extraApp.ExtraLogoUrl = string.Format("{0}{1}", NEWS_LOGOS_IMAGE_PREFIX, Path.GetFileName(logoFilePath));
            }

            var ret = dbContextService.Update <NewsExtraApp>(extraApp);

            NewsUIService.UpdateServerVersion <NewsExtraApp>();

            return(RedirectToAction("ExtraAppList"));
        }
Exemplo n.º 2
0
        public ActionResult InfAddressDelete(int infAddressId)
        {
            var ret = dbContextService.Delete <NewsInfAddress>(infAddressId);

            NewsUIService.UpdateServerVersion <NewsInfAddress>();

            return(RedirectToAction("InfAddressList"));
        }
Exemplo n.º 3
0
        public ActionResult ExtraRatioDelete(int extraRatioId)
        {
            var ret = dbContextService.Delete <NewsExtraRatio>(extraRatioId);

            NewsUIService.UpdateServerVersion <NewsExtraApp>();

            return(RedirectToAction("ExtraRatioList"));
        }
Exemplo n.º 4
0
        public ActionResult SubCategoryDelete(int subcategoryId)
        {
            var ret = dbContextService.Delete <NewsSubCategory>(subcategoryId);

            NewsUIService.UpdateServerVersion <NewsSubCategory>();

            return(RedirectToAction("SubCategoryList"));
        }
Exemplo n.º 5
0
        public ActionResult SourceDelete(int sourceId)
        {
            var ret = dbContextService.Delete <NewsSource>(sourceId);

            NewsUIService.UpdateServerVersion <NewsSource>();

            return(RedirectToAction("SourceList"));
        }
Exemplo n.º 6
0
        public ActionResult SubCategoryAdd()
        {
            var sourcelist   = NewsUIService.GetNewsSourceList().ToList();
            var categorylist = NewsUIService.GetNewsCategoryList().ToList();

            ViewData["Sourcelist"]   = sourcelist.GetSelectList();
            ViewData["Categorylist"] = categorylist.GetSelectList();
            return(View());
        }
Exemplo n.º 7
0
        public ActionResult NewsAdd()
        {
            var categorylist    = NewsUIService.GetNewsCategoryList().ToList();
            var subcategorylist = NewsUIService.GetNewsSubCategoryList().ToList();
            var extraapplist    = NewsUIService.GetNewsExtraAppList().ToList();

            ViewData["Categorylist"]    = categorylist.GetSelectList();
            ViewData["SubCategorylist"] = subcategorylist.GetSelectList();
            ViewData["ExtraApplist"]    = extraapplist.GetSelectList();

            return(View());
        }
Exemplo n.º 8
0
        public ActionResult SubCategoryEdit(int subcategoryId)
        {
            var subcategory = dbContextService.Single <NewsSubCategory>(subcategoryId);

            var sourcelist   = NewsUIService.GetNewsSourceList().ToList();
            var categorylist = NewsUIService.GetNewsCategoryList().ToList();

            ViewData["Sourcelist"]   = sourcelist.GetSelectList(subcategory.SourceId);
            ViewData["Categorylist"] = categorylist.GetSelectList(subcategory.CategoryId);

            ViewData["IsUpdate"] = true;
            return(View("SubCategoryAdd", subcategory));
        }
Exemplo n.º 9
0
        public ActionResult CategoryEdit(NewsCategory model)
        {
            var category = dbContextService.Single <NewsCategory>(model.Id);

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

            var ret = dbContextService.Update <NewsCategory>(category);

            NewsUIService.UpdateServerVersion <NewsCategory>();

            return(RedirectToAction("CategoryList"));
        }
Exemplo n.º 10
0
        public ActionResult SubCategoryAdd(NewsSubCategory model)
        {
            var exist = dbContextService.Exists <NewsSubCategory>(x => x.NameLowCase == model.NameLowCase);

            if (exist)
            {
                TempData["errorMsg"] = "该子分类已存在!";
                return(View());
            }
            var ret = dbContextService.Add <NewsSubCategory>(model);

            NewsUIService.UpdateServerVersion <NewsSubCategory>();

            return(RedirectToAction("SubCategoryList"));
        }
Exemplo n.º 11
0
        public ActionResult InfAddressEdit(int infAddressId)
        {
            var extraApp = dbContextService.Single <NewsInfAddress>(infAddressId);

            var sourcelist      = NewsUIService.GetNewsSourceList().ToList();
            var categorylist    = NewsUIService.GetNewsCategoryList().ToList();
            var subcategorylist = NewsUIService.GetNewsSubCategoryList().ToList();

            ViewData["Sourcelist"]      = sourcelist.GetSelectList();
            ViewData["Categorylist"]    = categorylist.GetSelectList();
            ViewData["SubCategorylist"] = subcategorylist.GetSelectList();

            ViewData["IsUpdate"] = true;
            return(View("InfAddressAdd", extraApp));
        }
Exemplo n.º 12
0
        public ActionResult SourceAdd(NewsSource model)
        {
            var exist = dbContextService.Exists <NewsSource>(x => x.Name == model.NameLowCase || x.PackageName == model.PackageName);

            if (exist)
            {
                TempData["errorMsg"] = "该提供商已存在!";
                return(View());
            }
            var ret = dbContextService.Add <NewsSource>(model);

            NewsUIService.UpdateServerVersion <NewsSource>();

            return(RedirectToAction("SourceList"));
        }
Exemplo n.º 13
0
        public ActionResult NewsEdit(int newsId)
        {
            var news = dbContextService.Single <NewsContent>(newsId);

            var categorylist    = NewsUIService.GetNewsCategoryList().ToList();
            var subcategorylist = NewsUIService.GetNewsSubCategoryList().ToList();
            var extraapplist    = NewsUIService.GetNewsExtraAppList().ToList();

            ViewData["Categorylist"]    = categorylist.GetSelectList(news.CategoryId);
            ViewData["SubCategorylist"] = subcategorylist.GetSelectList(news.SubCategoryId);
            ViewData["ExtraApplist"]    = extraapplist.GetSelectList(news.ExtraAppId);

            ViewData["IsUpdate"] = true;
            return(View("NewsAdd", news));
        }
Exemplo n.º 14
0
        public ActionResult InfAddressAdd(NewsInfAddress model)
        {
            var exist = dbContextService.Exists <NewsInfAddress>(x => x.InfAddress == model.InfAddress);

            if (exist)
            {
                TempData["errorMsg"] = "该接口地址已存在!";
                return(View());
            }
            var ret = dbContextService.Add <NewsInfAddress>(model);

            NewsUIService.UpdateServerVersion <NewsInfAddress>();

            return(RedirectToAction("InfAddressList"));
        }
Exemplo n.º 15
0
        public ActionResult ExtraRatioEdit(NewsExtraRatio model)
        {
            var extraRatio = dbContextService.Single <NewsExtraRatio>(model.Id);

            extraRatio.ChannelId      = model.ChannelId;
            extraRatio.Ratio          = model.Ratio;
            extraRatio.Status         = model.Status;
            extraRatio.CreateDateTime = DateTime.Now;

            var ret = dbContextService.Update <NewsExtraRatio>(extraRatio);

            NewsUIService.UpdateServerVersion <NewsExtraApp>();

            return(RedirectToAction("ExtraRatioList"));
        }
Exemplo n.º 16
0
        public ActionResult SourceEdit(NewsSource model)
        {
            var source = dbContextService.Single <NewsSource>(model.Id);

            source.Name           = model.Name;
            source.NameLowCase    = source.NameLowCase;
            source.PackageName    = source.PackageName;
            source.Status         = model.Status;
            source.CreateDateTime = DateTime.Now;

            var ret = dbContextService.Update <NewsSource>(source);

            NewsUIService.UpdateServerVersion <NewsSource>();

            return(RedirectToAction("SourceList"));
        }
Exemplo n.º 17
0
        public ActionResult ExtraRatioAdd(NewsExtraRatio model)
        {
            var exist = dbContextService.Exists <NewsExtraRatio>(x => x.ChannelId == model.ChannelId);

            if (exist)
            {
                TempData["errorMsg"] = "该渠道配置已存在!";
                return(View());
            }

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

            NewsUIService.UpdateServerVersion <NewsExtraApp>();

            return(RedirectToAction("ExtraRatioList"));
        }
Exemplo n.º 18
0
        public ActionResult SubCategoryEdit(NewsSubCategory model)
        {
            var subcategory = dbContextService.Single <NewsSubCategory>(model.Id);

            subcategory.Name        = model.Name;
            subcategory.NameLowCase = subcategory.NameLowCase;

            subcategory.SourceId       = subcategory.SourceId;
            subcategory.CategoryId     = subcategory.CategoryId;
            subcategory.Cursor         = subcategory.Cursor;
            subcategory.Status         = model.Status;
            subcategory.CreateDateTime = DateTime.Now;

            var ret = dbContextService.Update <NewsSubCategory>(subcategory);

            NewsUIService.UpdateServerVersion <NewsSubCategory>();

            return(RedirectToAction("SubCategoryList"));
        }
Exemplo n.º 19
0
        public ActionResult InfAddressEdit(NewsInfAddress model)
        {
            var infAddress = dbContextService.Single <NewsInfAddress>(model.Id);

            infAddress.Name           = model.Name;
            infAddress.SourceId       = model.SourceId;
            infAddress.CategoryId     = model.CategoryId;
            infAddress.SubCategoryId  = model.SubCategoryId;
            infAddress.IsStamp        = model.IsStamp;
            infAddress.InfAddress     = model.InfAddress;
            infAddress.Status         = model.Status;
            infAddress.CreateDateTime = DateTime.Now;

            var ret = dbContextService.Update <NewsInfAddress>(infAddress);

            NewsUIService.UpdateServerVersion <NewsInfAddress>();

            return(RedirectToAction("InfAddressList"));
        }
Exemplo n.º 20
0
        public ActionResult ExtraAppAdd(NewsExtraApp model)
        {
            var exist = dbContextService.Exists <NewsExtraApp>(x => x.Name == model.Name);

            if (exist)
            {
                TempData["errorMsg"] = "该外推应用已存在!";
                return(View());
            }
            var logoFile = Request.Files[Request.Files.Keys[0]];

            var logoFilePath = GetNewsLogoFilePath <NewsExtraApp>(model, logoFile);

            if (!string.IsNullOrEmpty(logoFilePath))
            {
                model.ExtraLogoUrl = string.Format("{0}{1}", NEWS_LOGOS_IMAGE_PREFIX, Path.GetFileName(logoFilePath));
            }
            var ret = dbContextService.Add <NewsExtraApp>(model);

            NewsUIService.UpdateServerVersion <NewsExtraApp>();

            return(RedirectToAction("ExtraAppList"));
        }
Exemplo n.º 21
0
        public ActionResult TimeConvert(TimeStamp model)
        {
            var ret = NewsUIService.TimeConvert(model.InputTime.ToString("yyyy-MM-dd HH:mm:ss"), model.InputStamp.ToString());

            return(View(ret));
        }