Ejemplo n.º 1
0
        public ActionResult GetSite(string keyword, int Length, int Start)
        {
            string IDUser = Session["IDUser"].ToString();

            try
            {
                var res = dc.GetSite(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.SiteName,
                    d.Address,
                    d.IDSite
                };
                return(Json(new
                {
                    iTotalRecords = TotalRecords,
                    iTotalDisplayRecords = TotalRecords,
                    aaData = resutltJson
                }, JsonRequestBehavior.AllowGet));
            }


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