public async Task <StatusOrdemServico> GetById(StatusOrdemServicoFilter model) { var _statusordemservico = await this.SingleOrDefaultAsync(this.GetAll(this.DataAgregation(model)) .Where(_ => _.StatusOrdemServicoId == model.StatusOrdemServicoId)); return(_statusordemservico); }
public IQueryable <StatusOrdemServico> GetBySimplefilters(StatusOrdemServicoFilter filters) { var querybase = this.GetAll(this.DataAgregation(filters)) .WithBasicFilters(filters) .WithCustomFilters(filters); return(querybase); }
public async Task <dynamic> GetDataCustom(StatusOrdemServicoFilter filters) { var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new { Id = _.StatusOrdemServicoId, })); return(querybase); }
public async Task <IEnumerable <dynamic> > GetDataItem(StatusOrdemServicoFilter filters) { var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new { Id = _.StatusOrdemServicoId, Name = _.Nome })); return(querybase); }
public async Task <IActionResult> Get([FromQuery] StatusOrdemServicoFilter filters) { var result = new HttpResult <StatusOrdemServicoDto>(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 - StatusOrdemServico", filters)); } }
public async Task <IActionResult> Get(int id, [FromQuery] StatusOrdemServicoFilter filters) { var result = new HttpResult <StatusOrdemServicoDto>(this._logger); try { filters.StatusOrdemServicoId = id; var returnModel = await this._app.GetOne(filters); return(result.ReturnCustomResponse(this._app, returnModel)); } catch (Exception ex) { return(result.ReturnCustomException(ex, "Calemas.Erp - StatusOrdemServico", id)); } }
public async Task <IActionResult> Get([FromQuery] StatusOrdemServicoFilter 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, "StatusOrdemServico"); return(File(file, export.ContentTypeExcel(), export.GetFileName())); } throw new InvalidOperationException("invalid FilterBehavior"); } catch (Exception ex) { return(result.ReturnCustomException(ex, "Calemas.Erp - StatusOrdemServico", filters)); } }
public static IQueryable <StatusOrdemServico> OrderByDomain(this IQueryable <StatusOrdemServico> queryBase, StatusOrdemServicoFilter filters) { return(queryBase.OrderBy(_ => _.StatusOrdemServicoId)); }
public static IQueryable <StatusOrdemServico> WithBasicFilters(this IQueryable <StatusOrdemServico> queryBase, StatusOrdemServicoFilter filters) { var queryFilter = queryBase; if (filters.StatusOrdemServicoId.IsSent()) { queryFilter = queryFilter.Where(_ => _.StatusOrdemServicoId == filters.StatusOrdemServicoId); } if (filters.Nome.IsSent()) { queryFilter = queryFilter.Where(_ => _.Nome.Contains(filters.Nome)); } if (filters.Descricao.IsSent()) { queryFilter = queryFilter.Where(_ => _.Descricao.Contains(filters.Descricao)); } if (filters.Ativo.IsSent()) { queryFilter = queryFilter.Where(_ => _.Ativo == filters.Ativo); } 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 <StatusOrdemServico> WithCustomFilters(this IQueryable <StatusOrdemServico> queryBase, StatusOrdemServicoFilter filters) { var queryFilter = queryBase; return(queryFilter); }
public virtual Task <PaginateResult <StatusOrdemServico> > GetByFiltersPaging(StatusOrdemServicoFilter filters) { var queryBase = this._rep.GetBySimplefilters(filters); return(this._rep.PagingAndDefineFields(filters, queryBase)); }
public virtual async Task <IEnumerable <StatusOrdemServico> > GetByFilters(StatusOrdemServicoFilter filters) { var queryBase = this._rep.GetBySimplefilters(filters); return(await this._rep.ToListAsync(queryBase)); }
public virtual async Task <StatusOrdemServico> GetOne(StatusOrdemServicoFilter filters) { return(await this._rep.GetById(filters)); }