public async Task <ProjetoDocumento> GetById(ProjetoDocumentoFilter model)
        {
            var _projetodocumento = await this.SingleOrDefaultAsync(this.GetAll(this.DataAgregation(model))
                                                                    .Where(_ => _.ProjetoId == model.ProjetoId).Where(_ => _.DocumentoId == model.DocumentoId));

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

            return(querybase);
        }
        public IQueryable <ProjetoDocumento> GetBySimplefilters(ProjetoDocumentoFilter filters)
        {
            var querybase = this.GetAll(this.DataAgregation(filters))
                            .WithBasicFilters(filters)
                            .WithCustomFilters(filters)
                            .OrderByDomain(filters)
                            .OrderByProperty(filters);

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

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

                return(result.ReturnCustomResponse(this._app, searchResult, filters));
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Target.Pendencias - ProjetoDocumento", filters));
            }
        }
        public async Task <IActionResult> Get(int id, [FromQuery] ProjetoDocumentoFilter filters)
        {
            var result = new HttpResult <ProjetoDocumentoDto>(this._logger);

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

                return(result.ReturnCustomResponse(this._app, returnModel));
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Target.Pendencias - ProjetoDocumento", id));
            }
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Get([FromQuery] ProjetoDocumentoFilter 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, "ProjetoDocumento");
                    return(File(file, export.ContentTypeExcel(), export.GetFileName()));
                }

                throw new InvalidOperationException("invalid FilterBehavior");
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Target.Pendencias - ProjetoDocumento", filters));
            }
        }
Exemplo n.º 7
0
 public static IQueryable <ProjetoDocumento> OrderByDomain(this IQueryable <ProjetoDocumento> queryBase, ProjetoDocumentoFilter filters)
 {
     return(queryBase);
 }
        public static IQueryable <ProjetoDocumento> WithBasicFilters(this IQueryable <ProjetoDocumento> queryBase, ProjetoDocumentoFilter filters)
        {
            var queryFilter = queryBase;

            if (filters.ProjetoId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.ProjetoId == filters.ProjetoId);
            }
            if (filters.DocumentoId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.DocumentoId == filters.DocumentoId);
            }


            return(queryFilter);
        }
Exemplo n.º 9
0
        public virtual Task <PaginateResult <ProjetoDocumento> > GetByFiltersPaging(ProjetoDocumentoFilter filters)
        {
            var queryBase = this._rep.GetBySimplefilters(filters);

            return(this._rep.PagingAndDefineFields(filters, queryBase));
        }
Exemplo n.º 10
0
        public virtual async Task <IEnumerable <ProjetoDocumento> > GetByFilters(ProjetoDocumentoFilter filters)
        {
            var queryBase = this._rep.GetBySimplefilters(filters);

            return(await this._rep.ToListAsync(queryBase));
        }
Exemplo n.º 11
0
 public virtual async Task <ProjetoDocumento> GetOne(ProjetoDocumentoFilter filters)
 {
     return(await this._rep.GetById(filters));
 }
        public static IQueryable <ProjetoDocumento> WithCustomFilters(this IQueryable <ProjetoDocumento> queryBase, ProjetoDocumentoFilter filters)
        {
            var queryFilter = queryBase;


            return(queryFilter);
        }