public async Task <PendenciaEventos> GetById(PendenciaEventosFilter model) { var _pendenciaeventos = await this.SingleOrDefaultAsync(this.GetAll(this.DataAgregation(model)) .Where(_ => _.PendenciaEventosId == model.PendenciaEventosId)); return(_pendenciaeventos); }
public async Task <dynamic> GetDataCustom(PendenciaEventosFilter filters) { var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new { Id = _.PendenciaEventosId, })); return(querybase); }
public IQueryable <PendenciaEventos> GetBySimplefilters(PendenciaEventosFilter filters) { var querybase = this.GetAll(this.DataAgregation(filters)) .WithBasicFilters(filters) .WithCustomFilters(filters) .OrderByDomain(filters) .OrderByProperty(filters); return(querybase); }
public async Task <IActionResult> Get([FromQuery] PendenciaEventosFilter filters) { var result = new HttpResult <PendenciaEventosDto>(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 - PendenciaEventos", filters)); } }
public async Task <IActionResult> Get(int id, [FromQuery] PendenciaEventosFilter filters) { var result = new HttpResult <PendenciaEventosDto>(this._logger); try { filters.PendenciaEventosId = id; var returnModel = await this._app.GetOne(filters); return(result.ReturnCustomResponse(this._app, returnModel)); } catch (Exception ex) { return(result.ReturnCustomException(ex, "Target.Pendencias - PendenciaEventos", id)); } }
public async Task <IActionResult> Get([FromQuery] PendenciaEventosFilter 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, "PendenciaEventos"); return(File(file, export.ContentTypeExcel(), export.GetFileName())); } throw new InvalidOperationException("invalid FilterBehavior"); } catch (Exception ex) { return(result.ReturnCustomException(ex, "Target.Pendencias - PendenciaEventos", filters)); } }
public static IQueryable <PendenciaEventos> WithCustomFilters(this IQueryable <PendenciaEventos> queryBase, PendenciaEventosFilter filters) { var queryFilter = queryBase; return(queryFilter); }
public static IQueryable <PendenciaEventos> WithBasicFilters(this IQueryable <PendenciaEventos> queryBase, PendenciaEventosFilter filters) { var queryFilter = queryBase; if (filters.PendenciaEventosId.IsSent()) { queryFilter = queryFilter.Where(_ => _.PendenciaEventosId == filters.PendenciaEventosId); } if (filters.PendenciaId.IsSent()) { queryFilter = queryFilter.Where(_ => _.PendenciaId == filters.PendenciaId); } if (filters.Descricao.IsSent()) { queryFilter = queryFilter.Where(_ => _.Descricao.Contains(filters.Descricao)); } if (filters.DataStart.IsSent()) { queryFilter = queryFilter.Where(_ => _.Data != null && _.Data.Value >= filters.DataStart.Value); } if (filters.DataEnd.IsSent()) { filters.DataEnd = filters.DataEnd.Value.AddDays(1).AddMilliseconds(-1); queryFilter = queryFilter.Where(_ => _.Data != null && _.Data.Value <= filters.DataEnd); } if (filters.UserCreateId.IsSent()) { queryFilter = queryFilter.Where(_ => _.UserCreateId == filters.UserCreateId); } if (filters.UserCreateDateStart.IsSent()) { queryFilter = queryFilter.Where(_ => _.UserCreateDate >= filters.UserCreateDateStart); } if (filters.UserCreateDateEnd.IsSent()) { filters.UserCreateDateEnd = filters.UserCreateDateEnd.AddDays(1).AddMilliseconds(-1); queryFilter = queryFilter.Where(_ => _.UserCreateDate <= filters.UserCreateDateEnd); } if (filters.UserAlterId.IsSent()) { queryFilter = queryFilter.Where(_ => _.UserAlterId != null && _.UserAlterId.Value == filters.UserAlterId); } if (filters.UserAlterDateStart.IsSent()) { queryFilter = queryFilter.Where(_ => _.UserAlterDate != null && _.UserAlterDate.Value >= filters.UserAlterDateStart.Value); } if (filters.UserAlterDateEnd.IsSent()) { filters.UserAlterDateEnd = filters.UserAlterDateEnd.Value.AddDays(1).AddMilliseconds(-1); queryFilter = queryFilter.Where(_ => _.UserAlterDate != null && _.UserAlterDate.Value <= filters.UserAlterDateEnd); } return(queryFilter); }
public static IQueryable <PendenciaEventos> OrderByDomain(this IQueryable <PendenciaEventos> queryBase, PendenciaEventosFilter filters) { return(queryBase.OrderBy(_ => _.PendenciaEventosId)); }
public virtual Task <PaginateResult <PendenciaEventos> > GetByFiltersPaging(PendenciaEventosFilter filters) { var queryBase = this._rep.GetBySimplefilters(filters); return(this._rep.PagingAndDefineFields(filters, queryBase)); }
public virtual async Task <IEnumerable <PendenciaEventos> > GetByFilters(PendenciaEventosFilter filters) { var queryBase = this._rep.GetBySimplefilters(filters); return(await this._rep.ToListAsync(queryBase)); }
public virtual async Task <PendenciaEventos> GetOne(PendenciaEventosFilter filters) { return(await this._rep.GetById(filters)); }