Ejemplo n.º 1
0
        public JsonResult Personnes([FromBody] Pagination pagination)
        {
            if (pagination != null)
            {
                var results = _formationService.GetPersonnes();
                if (!String.IsNullOrEmpty(pagination.Search))
                {
                    results = _formationService.GetPersonnes().Where(i => i.Prenom.Contains(pagination.Search) || i.Nom.Contains(pagination.Search));
                }
                int totalRows = results.Count();
                Util.Paginate <Personne>(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
                }));
            }
        }