BAL.Manager.PersonManager.GetBestPersons C# (CSharp) Method

GetBestPersons() public method

public GetBestPersons ( AvailableRoles role, int count ) : IEnumerable
role AvailableRoles
count int
return IEnumerable
        public IEnumerable<PersonDTO> GetBestPersons(AvailableRoles role, int count)
        {
            var persons = Mapper.Map<List<PersonDTO>>(uOW.PersonRepo.All.Where(p => p.User.RoleId == (int)role)).ToList();
            persons.Sort(delegate (PersonDTO x, PersonDTO y)
            {
                var yRating = y.User.Rating != null ? (double)(y.User.Rating) : 0;
                var xRating = x.User.Rating != null ? (double)(x.User.Rating) : 0;
                return yRating.CompareTo(xRating);
            });
            return persons.Take(count);
        }