public async Task <StatusPagamento> GetById(StatusPagamentoFilter model)
        {
            var _statuspagamento = await this.SingleOrDefaultAsync(this.GetAll(this.DataAgregation(model))
                                                                   .Where(_ => _.StatusPagamentoId == model.StatusPagamentoId));

            return(_statuspagamento);
        }
        public IQueryable <StatusPagamento> GetBySimplefilters(StatusPagamentoFilter filters)
        {
            var querybase = this.GetAll(this.DataAgregation(filters))
                            .WithBasicFilters(filters)
                            .WithCustomFilters(filters);

            return(querybase);
        }
        public async Task <dynamic> GetDataCustom(StatusPagamentoFilter filters)
        {
            var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new
            {
                Id = _.StatusPagamentoId,
            }));

            return(querybase);
        }
        public async Task <IEnumerable <dynamic> > GetDataItem(StatusPagamentoFilter filters)
        {
            var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new
            {
                Id   = _.StatusPagamentoId,
                Name = _.Nome
            }));

            return(querybase);
        }
        public async Task <IActionResult> Get([FromQuery] StatusPagamentoFilter filters)
        {
            var result = new HttpResult <StatusPagamentoDto>(this._logger);

            try
            {
                var searchResult = await this._app.GetByFilters(filters);

                return(result.ReturnCustomResponse(this._app, searchResult, filters));
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Calemas.Erp - StatusPagamento", filters));
            }
        }
        public async Task <IActionResult> Get(int id, [FromQuery] StatusPagamentoFilter filters)
        {
            var result = new HttpResult <StatusPagamentoDto>(this._logger);

            try
            {
                filters.StatusPagamentoId = id;
                var returnModel = await this._app.GetOne(filters);

                return(result.ReturnCustomResponse(this._app, returnModel));
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Calemas.Erp - StatusPagamento", id));
            }
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Get([FromQuery] StatusPagamentoFilter filters)
        {
            var result = new HttpResult <dynamic>(this._logger);

            try
            {
                if (filters.FilterBehavior == FilterBehavior.GetDataItem)
                {
                    var searchResult = await this._rep.GetDataItem(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (filters.FilterBehavior == FilterBehavior.GetDataCustom)
                {
                    var searchResult = await this._rep.GetDataCustom(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (filters.FilterBehavior == FilterBehavior.GetDataListCustom)
                {
                    var searchResult = await this._rep.GetDataListCustom(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (filters.FilterBehavior == FilterBehavior.Export)
                {
                    var searchResult = await this._rep.GetDataListCustom(filters);

                    var export = new ExportExcelCustom <dynamic>(filters);
                    var file   = export.ExportFile(this.Response, searchResult, "StatusPagamento");
                    return(File(file, export.ContentTypeExcel(), export.GetFileName()));
                }

                throw new InvalidOperationException("invalid FilterBehavior");
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Calemas.Erp - StatusPagamento", filters));
            }
        }
Ejemplo n.º 8
0
        public static IQueryable <StatusPagamento> WithCustomFilters(this IQueryable <StatusPagamento> queryBase, StatusPagamentoFilter filters)
        {
            var queryFilter = queryBase;


            return(queryFilter);
        }
 public static IQueryable <StatusPagamento> OrderByDomain(this IQueryable <StatusPagamento> queryBase, StatusPagamentoFilter filters)
 {
     return(queryBase.OrderBy(_ => _.StatusPagamentoId));
 }
Ejemplo n.º 10
0
        public static IQueryable <StatusPagamento> WithBasicFilters(this IQueryable <StatusPagamento> queryBase, StatusPagamentoFilter filters)
        {
            var queryFilter = queryBase;

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


            return(queryFilter);
        }
        public virtual Task <PaginateResult <StatusPagamento> > GetByFiltersPaging(StatusPagamentoFilter filters)
        {
            var queryBase = this._rep.GetBySimplefilters(filters);

            return(this._rep.PagingAndDefineFields(filters, queryBase));
        }
        public virtual async Task <IEnumerable <StatusPagamento> > GetByFilters(StatusPagamentoFilter filters)
        {
            var queryBase = this._rep.GetBySimplefilters(filters);

            return(await this._rep.ToListAsync(queryBase));
        }
 public virtual async Task <StatusPagamento> GetOne(StatusPagamentoFilter filters)
 {
     return(await this._rep.GetById(filters));
 }