Exemplo n.º 1
0
        public JsonResult TypeAccessoires([FromBody] Pagination pagination)
        {
            if (pagination != null)
            {
                var results = _formationService.GetTypeAccessoires();
                if (!String.IsNullOrEmpty(pagination.Search))
                {
                    results = _formationService.GetTypeAccessoires().Where(i => i.Nom.Contains(pagination.Search) || i.Nom.Contains(pagination.Search));
                }
                int totalRows = results.Count();

                Util.Paginate <TypeAccessoire>(pagination, ref results);

                return(Json(new
                {
                    Rows = results.ToList(),
                    FilteredTotalRows = results.Count(),
                    TotalRows = totalRows
                }));
            }
            else
            {
                return(Json(new
                {
                    Rows = new List <Personne>(),
                    FilteredTotalRows = 0,
                    TotalRows = 0
                }));
            }
        }