コード例 #1
0
        /// <summary>
        /// 删除资讯
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public int deleteinformation(string ids)
        {
            bool isOK = new JiaJiBLL.infobll().infoDel(ids);

            if (isOK)
            {
                return(0);
            }
            else
            {
                return(1);
            }
        }
コード例 #2
0
        /// <summary>
        /// 显示
        /// </summary>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <returns></returns>
        public JsonResult getinformation(int page, int rows, string Title = "", int?CountryID = null, int?Site = null)
        {
            var list = new JiaJiBLL.infobll().INshow(Title);
            //var result = new { total = list.Count, rows = list.Skip((page - 1) * rows).Take(rows)};
            var result = new {
                total = list.
                        Where(e => e.Title.Contains(Title) &&
                              (CountryID == null ? true : e.CountryID == CountryID) &&
                              (Site == null ? true : e.Site == Site)
                              ).Count(),
                rows = list.
                       Where(e => e.Title.Contains(Title) &&
                             (CountryID == null?true:e.CountryID == CountryID) &&
                             (Site == null ? true : e.Site == Site)
                             ).Skip((page - 1) * rows).Take(rows)
            };

            return(Json(result));
        }
コード例 #3
0
 public JsonResult addinformation(JiaJiModels.Information infor)
 {
     try
     {
         infor.InformationImgUrl = "/image/" + infor.InformationImgUrl;
         var i = new JiaJiBLL.infobll().infoadd(infor);
         if (i > 0)
         {
             return(Json(new { Success = true, Message = "添加成功" }));
         }
         else
         {
             return(Json(new { Success = false, Message = "添加失败" }));
         }
     }
     catch
     {
         return(Json(new { Success = false, Message = "添加失败" }));
     }
 }
コード例 #4
0
        public JsonResult editinformation(JiaJiModels.Information model)
        {
            try
            {
                int id = model.InformationID;

                var i = new JiaJiBLL.infobll().UpdateInformation(model);
                if (i > 0)
                {
                    return(Json(new { Success = true, Message = "修改成功" }));
                }
                else
                {
                    return(Json(new { Success = false, Message = "修改失败" }));
                }
            }
            catch
            {
                return(Json(new { Success = false, Message = "修改失败" }));
            }
        }