Created
July 15, 2019 21:51
-
-
Save davidsonsousa/aec0b7db495046be91ef7837c0dedfc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public (IEnumerable<PersonTableViewModel> Data, int Count) GetPeopleForDataTable(DataParameters parameters) | |
{ | |
var items = personRepository.GetPeopleReadOnly() | |
.Select(x => new PersonTableViewModel | |
{ | |
FullName = x.FullName, | |
PreferredName = x.PreferredName, | |
Phone = x.Phone, | |
Email = x.Email, | |
Age = (DateTime.Now.Subtract(x.DateOfBirth).Days / 365).ToString(), | |
Status = x.Status == true ? "Active" : "Inactive" | |
}); | |
if (!string.IsNullOrWhiteSpace(parameters.Search.Value)) | |
{ | |
PersonTableViewModel.Filter(ref items, parameters.Search.Value); | |
} | |
PersonTableViewModel.Order(ref items, parameters.Order[0].Column, parameters.Order[0].Dir); | |
return (items, personRepository.Count()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment