Example #1
0
        public ActionResult GetCategory(string keyword, int Length, int Start)
        {
            try
            {
                var res = cc.GetCategory(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.Username,
                    d.dateentry.Value.ToShortDateString(),
                    d.userlastmaintenance,
                    d.datelastmaintenance.ToShortDateString() == "1900-01-01"?"":d.datelastmaintenance.ToShortDateString(),
                    d.Category_ID,
                };
                return(Json(new
                {
                    iTotalRecords = TotalRecords,
                    iTotalDisplayRecords = TotalRecords,
                    aaData = resutltJson
                }, JsonRequestBehavior.AllowGet));
            }


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