public async Task <IActionResult> Index( [FromServices] IStatementRepository repository, [FromQuery] FilterModel filter) { var statements = await repository.GetAll(); var statementsModel = new List <StatementModel>(); foreach (var statement in statements) { statementsModel.Add(new StatementModel(statement)); } var filteredList = statementsModel .Where(filter.FilterExp) .ToList(); var orderedList = GetOrderedList(filter.Order, filteredList); var model = new StatementIndexView() { Statements = orderedList, Filter = filter }; return(View(model)); }
public ResultMessage <ICollection <Statement> > GetAll(Expression <Func <Statement, bool> > filter = null) { return(statementRepository.GetAll(filter)); }