예제 #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"));
        }
예제 #2
0
        public ActionResult InfAddressDelete(int infAddressId)
        {
            var ret = dbContextService.Delete <NewsInfAddress>(infAddressId);

            NewsUIService.UpdateServerVersion <NewsInfAddress>();

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

            NewsUIService.UpdateServerVersion <NewsExtraApp>();

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

            NewsUIService.UpdateServerVersion <NewsSubCategory>();

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

            NewsUIService.UpdateServerVersion <NewsSource>();

            return(RedirectToAction("SourceList"));
        }
예제 #6
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"));
        }
예제 #7
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"));
        }
예제 #8
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"));
        }
예제 #9
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"));
        }
예제 #10
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"));
        }
예제 #11
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"));
        }
예제 #12
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"));
        }
예제 #13
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"));
        }
예제 #14
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"));
        }
예제 #15
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"));
        }