Exemple #1
0
        public GameFilteringViewModel Get(
            [FromUri] FilterViewModel filter = null)
        {
            var filterDto = filter == null
                ? new FilterDTO()
                : Mapper.Map <FilterDTO>(filter);

            var isWithDeleted = false;

            if (User.Identity.IsAuthenticated)
            {
                isWithDeleted = User.IsInRole("Administrator") ||
                                User.IsInRole("Manager") ||
                                User.IsInRole("Moderator");
            }

            FilterResultDTO gameFilterResult = _gameService.GetAllByFilter(filterDto, isWithDeleted, 1, PageEnum.All);

            var gamesDetailsViewModel = Mapper.Map <IEnumerable <GameViewModel> >(gameFilterResult.Games);

            var gameListViewModel = new GameFilteringViewModel
            {
                Games  = gamesDetailsViewModel,
                Filter = filter,
            };

            return(gameListViewModel);
        }
        public FilterResultDTO FilterTree([FromBody] PictureDTO picture)
        {
            var bmp = picture.getImage();
            var img = new Image <Bgr, byte>(bmp);

            var ret = new FilterResultDTO();

            ret.

            return(null);
        }
Exemple #3
0
 public FilterResultDTO <BoletoDTO> FiltrarBoletos(BoletoFilter filtro)
 {
     try
     {
         IEnumerable <Boleto> boletos = boletoRepository.FiltrarBoletos(filtro, true);
         var retorno = new FilterResultDTO <BoletoDTO>
         {
             Total         = filtro.Total,
             Pagina        = filtro.Pagina,
             TamanhoPagina = filtro.TamanhoPagina,
             Lista         = boletos.Select(x => new BoletoDTO(x))
         };
         return(retorno);
     }
     catch (Exception e)
     {
         log.Error("Erro ao buscar boletos.", e);
         throw new Exception("Erro ao buscar boletos.");
     }
 }
Exemple #4
0
 public FilterResultDTO <AlunoDTO> ListarAlunosPorVencimento(IPageFilter filter)
 {
     try
     {
         IEnumerable <Aluno> alunos = alunoRepository.ListarAlunosPorVencimento(filter);
         var retorno = new FilterResultDTO <AlunoDTO>
         {
             Total         = filter.Total,
             Pagina        = filter.Pagina,
             TamanhoPagina = filter.TamanhoPagina,
             Lista         = alunos.Select(x => new AlunoDTO(x))
         };
         return(retorno);
     }
     catch (Exception e)
     {
         log.Error("Erro ao buscar alunos por vencimento.", e);
         throw new Exception("Erro ao buscar alunos por vencimento.");
     }
 }
Exemple #5
0
 public FilterResultDTO <AlunoDTO> FiltrarAlunos(AlunoFilter filter)
 {
     try
     {
         IEnumerable <Aluno> alunos = alunoRepository.FiltrarAlunos(filter, true);
         var retorno = new FilterResultDTO <AlunoDTO>
         {
             Total         = filter.Total,
             Pagina        = filter.Pagina,
             TamanhoPagina = filter.TamanhoPagina,
             Lista         = alunos.Select(x => new AlunoDTO(x))
         };
         return(retorno);
     }
     catch (Exception e)
     {
         log.Error("Erro ao buscar alunos.", e);
         throw new Exception("Erro ao buscar alunos.");
     }
 }
Exemple #6
0
        public override FilterResultDTO filterImage(Image <Bgr, byte> Image)
        {
            FilterResultDTO filterDTO = new FilterResultDTO();

            var imageMask = Mask(Image);


            filterDTO.Density = imageMask.CountNonzero()[0] / ((double)imageMask.Width * imageMask.Height);
            filterDTO.Type    = FilterResultDTO.CaracteristicType.Trees;
            var mask = ImageHelper.MaskOverlay(Image, imageMask);
            var img  = mask.ToBitmap();

            mask.Dispose();

            filterDTO.base64image = Base64Converter.BitmapToBase64(img);

            imageMask.Dispose();

            return(filterDTO);
        }
Exemple #7
0
        public FilterResultDTO GetAllByFilter(FilterDTO filter, bool isWithDeleted = false, int page = 1, PageEnum pageSize = PageEnum.Ten)
        {
            if (filter == null)
            {
                throw new ValidationException("There is no filter", string.Empty);
            }

            var pipeline = new Pipeline <Game>();

            RegisterFilter(pipeline, filter, page, pageSize);
            var query        = pipeline.Execute();
            var result       = _unitOfWork.Repository <Game>().GetAll(query, isWithDeleted);
            var gamesDto     = Mapper.Map <IEnumerable <GameDTO> >(result.List.ToList());
            var filterResult = new FilterResultDTO
            {
                Games = gamesDto,
                Count = result.Count
            };

            return(filterResult);
        }