public async Task OnGetAsync(string Searchstring) { TableListModel model = new TableListModel(); var movies = from m in _context.Movie select m; if (!String.IsNullOrEmpty(Searchstring)) { movies = movies.Where(s => s.Title.Contains(Searchstring)); } Movie = await movies.ToListAsync(); }
public TableListModel GetTableListModel(long id) { var result = new TableListModel(); result.Table = _tableManager.GetById(id); result.Columns = _columnManager.List(x => x.TableId == id).OrderBy(x => x.ListOrder).ToList(); var q = $"SELECT {result.Table.Name}.Id AS Id,"; foreach (var item in result.Columns.Where(x => x.ShowInList)) { switch (item.ColumnType) { case ColumnType.SelectList: q += $"{item.TargetTable}.{item.TargetTableTextColumn} AS {item.Name},"; break; default: q += $"{result.Table.Name}.{item.Name} AS {item.Name},"; break; } } q = q.Trim(','); q += $" FROM {result.Table.Name}\n"; if (result.Columns.Any(x => x.ShowInList && x.ColumnType == ColumnType.SelectList)) { foreach (var item in result.Columns.Where(x => x.ShowInList && x.ColumnType == ColumnType.SelectList)) { q += $"LEFT JOIN {item.TargetTable} ON {item.TargetTable}.Id={result.Table.Name}.{item.Name} \n"; } } if (result.Table.MultipleLanguage) { q += $" WHERE {result.Table.Name}.LanguageId=" + App.Common.Language.Id; } result.Entries = new SqlProvider().List(q); return(result); }
private static Func <Reservation, bool> ReservationsByTableInfoPredicate(TableListModel tableListModel) => x => x.SelectedTable.ID == tableListModel.ID;
public ObservableCollection <ReservationListModel> GetReservationsByTableInfoList(TableListModel tableListModel) => GetReservationsCollection(ReservationsByTableInfoPredicate(tableListModel), Mapper.MapEntityToListModel);