예제 #1
0
        public async Task <IEnumerable <IVehicleModelDomain> > GetAllModelsAsync(Sorting sorting, Searching searching, PaginatedList <VehicleModel> paging)
        {
            SortBy   sortBy   = new SortBy();
            SearchBy searchBy = new SearchBy();
            Func <IQueryable <VehicleModel>, IOrderedQueryable <VehicleModel> > sort = sortBy.ModelOrderBy(sorting.SortString);

            if (!String.IsNullOrWhiteSpace(searching.SearchingString))
            {
                Expression <Func <VehicleModel, bool> > search = searchBy.ModelSearchBy(searching.SearchingString);
                return(_mapper.Map <IEnumerable <IVehicleModelDomain> >(await base.GetAllAsync(sort, paging, search)));
            }
            else
            {
                return(_mapper.Map <IEnumerable <IVehicleModelDomain> >(await base.GetAllAsync(sort, paging)));
            }
        }