Esempio n. 1
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"));
        }
Esempio n. 2
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"));
        }
Esempio n. 3
0
        public IList <NewsInfAddressView> GetInfAddressViewList(MobileParam mobileParams, int cver, out int sver)
        {
            #region instance

            var mode1 = new NewsInfAddress()
            {
                Id             = 1,
                Name           = "腾讯热门",
                SourceId       = 2,
                CategoryId     = 1,
                SubCategoryId  = 0,
                IsStamp        = 0,
                InfAddress     = "http://openapi.inews.qq.com/getNewsByChlidVerify?chlid=news&refer=openapi_for_tianyida&appkey=3XfMefMGRHJMpKZHKbKxFWvsFgO4FV&n=10",
                Status         = 1,
                CreateDateTime = DateTime.Now
            };

            var mode2 = new NewsInfAddress()
            {
                Id             = 2,
                Name           = "腾讯科技",
                SourceId       = 2,
                CategoryId     = 2,
                SubCategoryId  = 0,
                IsStamp        = 0,
                InfAddress     = "http://openapi.inews.qq.com/getNewsByChlidVerify?chlid=tech&refer=openapi_for_tianyida&appkey=3XfMefMGRHJMpKZHKbKxFWvsFgO4FV&n=10",
                Status         = 1,
                CreateDateTime = DateTime.Now
            };
            #endregion

            var modelist = new List <NewsInfAddress>()
            {
                mode1, mode2
            };
            sver = 1;
            var result = modelist.To <IList <NewsInfAddressView> >();

            return(result);
        }
Esempio n. 4
0
        public IList <NewsInfAddressView> GetInfAddressViewList(MobileParam mobileParams, int cver, out int sver)
        {
            var infAddressList = new NewsInfAddress().ReturnNewsInstance <NewsInfAddress>(cver, out sver);

            return(infAddressList.To <IList <NewsInfAddressView> >());
        }