Exemplo n.º 1
0
        public ResultList <ProduceEditModel> GetProduces(QueryOptions queryOptions, PrimeActs.Domain.ViewModels.Produce.SearchObject searchObject)
        {
            var totalCount = 0;
            var produces   = _produceService.GetProduces(queryOptions, searchObject, out totalCount);

            queryOptions.TotalPages = (int)Math.Ceiling((double)totalCount / queryOptions.PageSize);
            return
                (new ResultList <ProduceEditModel>(
                     produces != null ? produces.Select(BuildProduceEditModel).ToList() : null, queryOptions));
        }
Exemplo n.º 2
0
        public ProducePagingModel GetProducePagingModel(QueryOptions queryOptions, PrimeActs.Domain.ViewModels.Produce.SearchObject searchObject)
        {
            var totalCount         = 0;
            var producePagingModel = new ProducePagingModel();
            var produces           = _produceService.GetProduces(queryOptions, searchObject, out totalCount);

            queryOptions.TotalPages = (int)Math.Ceiling((double)totalCount / queryOptions.PageSize);
            //This line gets rid of items!! Fix the error
            var result = new ResultList <ProduceEditModel>(produces.Select(BuildProduceEditModel).ToList(),
                                                           queryOptions);

            producePagingModel.ProduceEditModels = result;
            producePagingModel.SearchObject      = new PrimeActs.Domain.ViewModels.Produce.SearchObject
            {
                ProduceCode = searchObject.ProduceCode,
                ProduceName = searchObject.ProduceName
            };
            return(producePagingModel);
        }