示例#1
0
        public ActionResult GetCategoryOfDevices(string keyword, int Length, int Start)
        {
            string IDUser = Session["IDUser"].ToString();

            try
            {
                var res = dc.GetDeviceCategory(keyword, Length, Start);
                int?TotalRecords;
                if (res.Count() > 0)
                {
                    TotalRecords = res.FirstOrDefault().TotalRecords;
                }
                else
                {
                    TotalRecords = 0;
                }
                var resutltJson = from d in res
                                  select new string[]
                {
                    d.Category_Name,
                    d.Category_Description,
                    d.Category_ID
                };
                return(Json(new
                {
                    iTotalRecords = TotalRecords,
                    iTotalDisplayRecords = TotalRecords,
                    aaData = resutltJson
                }, JsonRequestBehavior.AllowGet));
            }


            catch (Exception err)
            {
                return(Content(err.ToString()));
            }
        }