/// <summary>
        /// Prepare paged return request action list model
        /// </summary>
        /// <param name="searchModel">Return request action search model</param>
        /// <returns>Return request action list model</returns>
        public virtual async Task <ReturnRequestActionListModel> PrepareReturnRequestActionListModelAsync(ReturnRequestActionSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get return request actions
            var actions = (await _returnRequestService.GetAllReturnRequestActionsAsync()).ToPagedList(searchModel);

            //prepare list model
            var model = new ReturnRequestActionListModel().PrepareToGrid(searchModel, actions, () =>
            {
                return(actions.Select(reason => reason.ToModel <ReturnRequestActionModel>()));
            });

            return(model);
        }
Exemple #2
0
        /// <summary>
        /// Prepare paged return request action list model
        /// </summary>
        /// <param name="searchModel">Return request action search model</param>
        /// <returns>Return request action list model</returns>
        public virtual ReturnRequestActionListModel PrepareReturnRequestActionListModel(ReturnRequestActionSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get return request actions
            var actions = _returnRequestService.GetAllReturnRequestActions();

            //prepare list model
            var model = new ReturnRequestActionListModel
            {
                //fill in model values from the entity
                Data  = actions.PaginationByRequestModel(searchModel).Select(action => action.ToModel()),
                Total = actions.Count
            };

            return(model);
        }