Пример #1
0
 public ActionResult Available(string ids)
 {
     if (!string.IsNullOrEmpty(ids))
     {
         var    idarray = ids.Split(',');
         string sqlids  = "'" + string.Join("','", idarray) + "'";
         string sql     = "update Info set isavailable=1,UpdateDate=GETDATE(),UpdateBy='" + cuser.UserID + "',UpdateByName='" + cuser.LoginName + "' where id in (" + sqlids + ")";
         if (infoService.ExecuteSql(sql, out msg) > 0)
         {
             return(Json(new AjaxResult()
             {
                 success = true, msg = AvailableSuccess, url = Url.Action("index")
             }));
         }
         else
         {
             msg = errorOutPutToPage ? msg : AvailableFailure;
             return(Json(new AjaxResult()
             {
                 success = false, msg = msg
             }));
         }
     }
     else
     {
         return(Json(new AjaxResult()
         {
             success = false, msg = didnotchoosedata
         }));
     }
 }
Пример #2
0
        // GET: Article/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Info info = infoService.Find(id);

            infoService.ExecuteSql("update Info set ViewCount=ViewCount+1 where id=@id", out msg, new SqlParameter("@id", id));
            if (info == null)
            {
                return(HttpNotFound());
            }
            var InfoCategoryTypeList = CacheMaker.IISCache.GetOrSetThenGet("InfoCategoryType_Cache_Key", () =>
            {
                return(cateService.GetQueryable(cate => cate.CateTypeID == "InfoCategoryType").OrderByDescending(c => c.UpdateDate).ThenByDescending(c => c.AddDate).Select(cate => new SelectListItem {
                    Value = cate.ID, Text = cate.Name
                }).ToList());
            });

            ViewBag.InfoCategoryTypeList = InfoCategoryTypeList;
            return(View(info));
        }