예제 #1
0
        public PagedResultsDto GetAllFeatures(long adminId, int page, int pageSize)
        {
            var user = _userService.Find(adminId);

            if (user == null)
            {
                throw new ValidationException(ErrorCodes.UserNotFound);
            }
            if (user.IsDeleted)
            {
                throw new ValidationException(ErrorCodes.UserDeleted);
            }
            if (!user.IsActive)
            {
                throw new ValidationException(ErrorCodes.UserDeactivated);
            }
            var             featuresCount = _featureService.Query(x => !x.IsDeleted && x.CreationBy == adminId).Select().Count();
            var             features      = Mapper.Map <List <FeatureDto> >(_featureService.GetAllFeaturesAdminId(adminId, page, pageSize));
            PagedResultsDto results       = new PagedResultsDto
            {
                TotalCount = featuresCount,
                Data       = features
            };

            return(results);
        }