public async Task <IActionResult> Get([FromQuery] SampleStandartFilter 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.GetDataListCustomPaging) { var paginatedResult = await this._rep.GetDataListCustomPaging(filters); return(result.ReturnCustomResponse(paginatedResult.ToSearchResult <dynamic>(), 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, "SampleStandart", this._env.RootPath); return(File(file, export.ContentTypeExcel(), export.GetFileName())); } throw new InvalidOperationException("invalid FilterBehavior"); } catch (Exception ex) { return(result.ReturnCustomException(ex, "Seed - SampleStandart", filters, new ErrorMapCustom())); } }
public async Task <IActionResult> Get([FromQuery] PrioridadeFilter 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, "Prioridade"); return(File(file, export.ContentTypeExcel(), export.GetFileName())); } throw new InvalidOperationException("invalid FilterBehavior"); } catch (Exception ex) { return(result.ReturnCustomException(ex, "Calemas.Erp - Prioridade", filters)); } }
public async Task <IActionResult> Get([FromQuery] GroupParticipantFilter 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 (!this._user.GetClaims().GetTools().VerifyClaimsCanRead("GroupParticipant")) { return(new ObjectResult(null) { StatusCode = (int)HttpStatusCode.Forbidden }); } 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.GetDataListCustomPaging) { var paginatedResult = await this._rep.GetDataListCustomPaging(filters); return(result.ReturnCustomResponse(paginatedResult.ToSearchResult <dynamic>(), 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, "GroupParticipant", this._env.RootPath); return(File(file, export.ContentTypeExcel(), export.GetFileName())); } throw new InvalidOperationException("invalid FilterBehavior"); } catch (Exception ex) { var responseEx = result.ReturnCustomException(ex, "Seed - GroupParticipant", filters, new ErrorMapCustom()); return(responseEx); } }
public async Task <IActionResult> Get([FromQuery] SampleFilter filters) { var result = new HttpResult <dynamic>(this._logger); try { if (filters.FilterBehavior == FilterBehavior.GetDataItem) { if (this._user.GetClaims().GetTools().VerifyClaimsCanReadDataItem("Sample")) { var searchResult = await this._rep.GetDataItem(filters); return(result.ReturnCustomResponse(searchResult, filters)); } else { return(new ObjectResult(null) { StatusCode = (int)HttpStatusCode.Forbidden }); } } else if (this._user.GetClaims().GetTools().VerifyClaimsCanReadCustom("Sample")) { if (filters.FilterBehavior == FilterBehavior.GetDataCustom) { var searchResult = await this._rep.GetDataCustom(filters); return(result.ReturnCustomResponse(searchResult, filters)); } if (filters.FilterBehavior == FilterBehavior.GetDataListCustom) { var filterKey = filters.CompositeKey(this._user); if (filters.ByCache) { if (this._cache.ExistsKey(filterKey)) { return(result.ReturnCustomResponse(this._cache.Get <IEnumerable <object> >(filterKey), filters)); } } var searchResult = await this._rep.GetDataListCustom(filters); this.AddCache(filters, filterKey, searchResult, "Sample"); return(result.ReturnCustomResponse(searchResult, filters)); } if (filters.FilterBehavior == FilterBehavior.GetDataListCustomPaging) { var filterKey = filters.CompositeKey(this._user); if (filters.ByCache) { if (this._cache.ExistsKey(filterKey)) { return(result.ReturnCustomResponse(this._cache.Get <IEnumerable <object> >(filterKey), filters)); } } var paginatedResult = await this._rep.GetDataListCustomPaging(filters); this.AddCache(filters, filterKey, paginatedResult.ResultPaginatedData, "Sample"); return(result.ReturnCustomResponse(paginatedResult.ToSearchResult <dynamic>(), 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, "Sample", this._env.RootPath); return(File(file, export.ContentTypeExcel(), export.GetFileName())); } } else { return(new ObjectResult(null) { StatusCode = (int)HttpStatusCode.Forbidden }); } throw new InvalidOperationException("invalid FilterBehavior"); } catch (Exception ex) { var responseEx = result.ReturnCustomException(ex, "Seed - Sample", filters); return(responseEx); } }