public virtual TripListModel PrepareListModel(TripSearchModel searchModel) { if (null == searchModel) { throw new ArgumentNullException(nameof(searchModel)); } var list = tripService.GetAll( pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize, carLicense: searchModel.SearchCarLicense, driverName: searchModel.SearchDriverName, serialNum: searchModel.SearchSerialNum, shippingStatuses: (searchModel.SearchShippingStatuses?.Contains(0) ?? false) ? null : searchModel.SearchShippingStatuses, startAtFrom: searchModel.SearchStartAtFrom, startAtTo: searchModel.SearchStartAtTo, endAtFrom: searchModel.SearchEndAtFrom, endAtTo: searchModel.SearchEndAtTo); var model = new TripListModel { Data = list.Select(x => { var modelItem = x.ToModel <TripModel>(); PrepareModel(ref modelItem); return(modelItem); }), Total = list.TotalCount }; return(model); }
private void setTripList() { var tripListElements = Trip.ItemsSource.Select(x => new TripElementModel { Position = x.Position, StopName = x.Stop.Name, RoutedItem = x }); var tripList = new TripListModel(tripListElements); tripList.SelectedIndex = 0; this.TripList = tripList; }