public async Task <SampleType> GetById(SampleTypeFilter model) { var _sampletype = await this.SingleOrDefaultAsync(this.GetAll(this.DataAgregation(model)) .Where(_ => _.SampleTypeId == model.SampleTypeId)); return(_sampletype); }
public async Task <IActionResult> Get(int id, [FromQuery] SampleTypeFilter filters) { if (id.IsSent()) { filters.SampleTypeId = id; } return(await base.GetOne(filters, "Seed - SampleType")); }
public async Task <dynamic> GetDataCustom(SampleTypeFilter filters) { var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new { Id = _.SampleTypeId, })); return(querybase); }
public async Task <PaginateResult <dynamic> > GetDataListCustomPaging(SampleTypeFilter filters) { var querybase = await this.PagingDataListCustom <dynamic>(filters, this.GetBySimplefilters(filters).Select(_ => new { Id = _.SampleTypeId })); return(querybase); }
public async Task <IEnumerable <dynamic> > GetDataItem(SampleTypeFilter filters) { var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new { Id = _.SampleTypeId, Name = _.Name })); return(querybase); }
public IQueryable <SampleType> GetBySimplefilters(SampleTypeFilter filters) { var querybase = this.GetAll(this.DataAgregation(filters)) .WithBasicFilters(filters) .WithCustomFilters(filters) .OrderByDomain(filters) .OrderByProperty(filters); return(querybase); }
public async Task <IActionResult> Get([FromQuery] SampleTypeFilter 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, "SampleType", this._env.RootPath); return(File(file, export.ContentTypeExcel(), export.GetFileName())); } throw new InvalidOperationException("invalid FilterBehavior"); } catch (Exception ex) { return(result.ReturnCustomException(ex, "Seed - SampleType", filters, new ErrorMapCustom())); } }
public async Task <IActionResult> Get([FromQuery] SampleTypeFilter filters) { var result = new HttpResult <SampleTypeDto>(this._logger); try { var searchResult = await this._app.GetByFilters(filters); return(result.ReturnCustomResponse(this._app, searchResult, filters)); } catch (Exception ex) { return(result.ReturnCustomException(ex, "Seed - SampleType", filters)); } }
public async Task <IActionResult> Get(int id, [FromQuery] SampleTypeFilter filters) { var result = new HttpResult <SampleTypeDto>(this._logger); try { filters.SampleTypeId = id; var returnModel = await this._app.GetOne(filters); return(result.ReturnCustomResponse(this._app, returnModel)); } catch (Exception ex) { return(result.ReturnCustomException(ex, "Seed - SampleType", id)); } }
public static IQueryable <SampleType> OrderByDomain(this IQueryable <SampleType> queryBase, SampleTypeFilter filters) { return(queryBase.OrderBy(_ => _.SampleTypeId)); }
public static IQueryable <SampleType> WithBasicFilters(this IQueryable <SampleType> queryBase, SampleTypeFilter filters) { var queryFilter = queryBase; if (filters.Ids.IsSent()) { queryFilter = queryFilter.Where(_ => filters.GetIds().Contains(_.SampleTypeId)); } if (filters.SampleTypeId.IsSent()) { queryFilter = queryFilter.Where(_ => _.SampleTypeId == filters.SampleTypeId); } if (filters.Name.IsSent()) { queryFilter = queryFilter.Where(_ => _.Name.Contains(filters.Name)); } return(queryFilter); }
public static IQueryable <SampleType> WithCustomFilters(this IQueryable <SampleType> queryBase, SampleTypeFilter filters) { var queryFilter = queryBase; return(queryFilter); }
public virtual Task <PaginateResult <SampleType> > GetByFiltersPaging(SampleTypeFilter filters) { var queryBase = this._rep.GetBySimplefilters(filters); return(this._rep.PagingAndDefineFields(filters, queryBase)); }
public virtual async Task <IEnumerable <SampleType> > GetByFilters(SampleTypeFilter filters) { var queryBase = this._rep.GetBySimplefilters(filters); return(await this._rep.ToListAsync(queryBase)); }
public virtual async Task <SampleType> GetOne(SampleTypeFilter filters) { return(await this._rep.GetById(filters)); }
public async Task <IActionResult> Get([FromQuery] SampleTypeFilter filters) { var result = new HttpResult <dynamic>(this._logger); try { if (filters.FilterBehavior == FilterBehavior.GetDataItem) { if (this._user.GetClaims().GetTools().VerifyClaimsCanReadDataItem("SampleType")) { 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("SampleType")) { 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, "SampleType"); 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, "SampleType"); 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, "SampleType", 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 - SampleType", filters); return(responseEx); } }
public async Task <IActionResult> Get([FromQuery] SampleTypeFilter filters) { return(await base.Get <SampleTypeFilter>(filters, "Seed - SampleType")); }