예제 #1
0
        public IQueryable <StatusNegocio> GetByFilters(StatusNegocioFilter filters)
        {
            var querybase = this.GetAll();

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

            return(queryFilter);
        }
예제 #2
0
        public async Task <IActionResult> Get([FromQuery] StatusNegocioFilter filters)
        {
            var result = new HttpResult <StatusNegocioDto>(this._logger, this._service);

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

                return(result.ReturnCustomResponse(searchResult));
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "StatusNegocio", filters));
            }
        }
예제 #3
0
        public async Task <IActionResult> DataItems([FromQuery] StatusNegocioFilter 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));
            }
        }
예제 #4
0
        public async Task <IActionResult> Get(int id, [FromQuery] StatusNegocioFilter filters)
        {
            var result = new HttpResult <StatusNegocioDto>(this._logger, this._service);

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

                return(result.ReturnCustomResponse(returnModel));
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "StatusNegocio", id));
            }
        }
예제 #5
0
        protected IQueryable <StatusNegocio> SimpleFilters(StatusNegocioFilter filters, IQueryable <StatusNegocio> queryBase)
        {
            var queryFilter = queryBase;

            if (filters.StatusNegocioId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.StatusNegocioId == filters.StatusNegocioId);
            }
            if (filters.Nome.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.Nome.Contains(filters.Nome));
            }
            if (filters.AssinaturaId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.AssinaturaId != null && _.AssinaturaId.Value == filters.AssinaturaId);
            }


            return(queryFilter);
        }
예제 #6
0
        public StatusNegocio GetById(StatusNegocioFilter filters)
        {
            var querybase = this.GetByFilters(filters);

            return(querybase.SingleOrDefault());
        }
예제 #7
0
        public virtual IEnumerable <dynamic> GetDataItems(StatusNegocioFilter filters)
        {
            var querybase = this.GetAll();

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