Пример #1
0
        public ActionResult List(DataTableModel dt, CityModel condition)
        {
            if (ModelState.IsValid)
            {
                using (ManageCityService service = new ManageCityService())
                {
                    int total_row = 0;
                    var dataList  = service.SearchCityList(dt, condition, out total_row);

                    int order         = 1;
                    int totalRowCount = dataList.Count();
                    int lastItem      = dt.iDisplayLength + dt.iDisplayStart;

                    var result = Json(
                        new
                    {
                        sEcho                = dt.sEcho,
                        iTotalRecords        = total_row,
                        iTotalDisplayRecords = total_row,
                        aaData               = (from i in dataList
                                                select new object[]
                        {
                            order++,
                            i.CITY_CD,
                            i.CITY_ZIP_CD != null ? HttpUtility.HtmlEncode(i.CITY_ZIP_CD) : String.Empty,
                            i.CITY_NAME != null ? HttpUtility.HtmlEncode(i.CITY_NAME) : String.Empty,
                            i.STATUS == "1"? "Hiển thị" : "Ẩn",
                            i.DEL_FLG
                        })
                    });

                    result.MaxJsonLength = Int32.MaxValue;
                    return(result);
                }
            }
            return(new EmptyResult());
        }