Exemplo n.º 1
0
        public ActionResult SlideList(DataTableModel dt, Slide condition)
        {
            if (ModelState.IsValid)
            {
                using (SlideService service = new SlideService())
                {
                    int total_row = 0;
                    var dataList  = service.SearchSlideList(dt, condition, out total_row);

                    int order    = 1;
                    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[]
                        {
                            i.ID,
                            order++,
                            i.Type == 1 ? "Slide Top": "Slide Left",
                            i.DisplayOrder,
                            i.Status == true? "Hiển thị" : "Ẩn",
                            i.CreatedDate != null ? i.CreatedDate.Value.ToString("dd/MM/yyyy") : String.Empty,
                            i.ModifiedDate != null ? i.ModifiedDate.Value.ToString("dd/MM/yyyy") : String.Empty,
                            i.del_flg
                        })
                    });

                    result.MaxJsonLength = Int32.MaxValue;
                    return(result);
                }
            }
            else
            {
                var ErrorMessages = ModelState.Where(x => x.Value.Errors.Count > 0).Select(x => new { x.Key, x.Value.Errors }).ToArray();
            }
            return(new EmptyResult());
        }