public DataTablesResult <UserTableRowViewModel> GetUsers(DataTablesParam dataTableParam) { return(DataTablesResult.Create(FakeDatabase.Users.Select(user => new UserTableRowViewModel() { Id = user.Id, Name = user.Name, Email = user.Email, Position = user.Position == null ? "" : user.Position.ToString(), Number = user.Number, Hired = user.Hired, IsAdmin = user.IsAdmin, Salary = user.Salary, Thumb = "https://randomuser.me/api/portraits/thumb/men/" + user.Id + ".jpg" }), dataTableParam, rowViewModel => new { Name = "<b>" + rowViewModel.Name + "</b>", Hired = rowViewModel.Hired == null ? "<pending>" : rowViewModel.Hired.Value.ToShortDateString() + " " + rowViewModel.Hired.Value.ToShortTimeString() + " (" + FriendlyDateHelper.GetPrettyDate(rowViewModel.Hired.Value) + ") ", Thumb = "<img src='" + rowViewModel.Thumb + "' />" })); }
public DataTablesResult <UserView> GetUsers(DataTablesParam dataTableParam) { return(DataTablesResult.Create(FakeDatabase.Users.Select(user => new UserView() { Id = user.Id, Name = user.Name, Email = user.Email, Position = user.Position == null ? "" : user.Position.ToString(), Number = user.Number, Hired = user.Hired, IsAdmin = user.IsAdmin, Salary = user.Salary }), dataTableParam, uv => new { Name = "<b>" + uv.Name + "</b>", Hired = uv.Hired == null ? "<pending>" : uv.Hired.Value.ToShortDateString() + " (" + FriendlyDateHelper.GetPrettyDate(uv.Hired.Value) + ") " })); }