Esempio n. 1
0
        public IQueryable <Pais> GetByFilters(PaisFilter filters)
        {
            var querybase = this.GetAll();

            var queryFilter = this.SimpleFilters(filters, querybase);

            return(queryFilter);
        }
Esempio n. 2
0
        public async Task <IActionResult> Get([FromQuery] PaisFilter filters)
        {
            var result = new HttpResult <PaisDto>(this._logger, this._service);

            try
            {
                var searchResult = await this._service.GetByFiltersPaging(filters);

                return(result.ReturnCustomResponse(searchResult));
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Pais", filters));
            }
        }
Esempio n. 3
0
        public async Task <IActionResult> DataItems([FromQuery] PaisFilter filters)
        {
            var result = new HttpResult <dynamic>(this._logger, this._service);

            try
            {
                var items = await this._service.GetDataItems(filters);

                return(result.ReturnCustomResponse(items));
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Assinatura", filters));
            }
        }
Esempio n. 4
0
        public async Task <IActionResult> Get(int id, [FromQuery] PaisFilter filters)
        {
            var result = new HttpResult <PaisDto>(this._logger, this._service);

            try
            {
                filters.PaisId = id;
                var returnModel = await this._service.GetById(filters);

                return(result.ReturnCustomResponse(returnModel));
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Pais", id));
            }
        }
Esempio n. 5
0
        protected IQueryable <Pais> SimpleFilters(PaisFilter filters, IQueryable <Pais> queryBase)
        {
            var queryFilter = queryBase;

            if (filters.PaisId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.PaisId == filters.PaisId);
            }
            if (filters.Nome.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.Nome.Contains(filters.Nome));
            }


            return(queryFilter);
        }
Esempio n. 6
0
        public Pais GetById(PaisFilter filters)
        {
            var querybase = this.GetByFilters(filters);

            return(querybase.SingleOrDefault());
        }
Esempio n. 7
0
        public virtual IEnumerable <dynamic> GetDataItems(PaisFilter filters)
        {
            var querybase = this.GetAll();

            return(this.GetAll().Select(_ => new { Id = _.PaisId, Name = _.Nome }));
        }