/// <summary> /// Gets the <see cref="Product"/> collection object that matches the selection criteria. /// </summary> /// <param name="args">The Args (see <see cref="ProductArgs"/>).</param> /// <param name="paging">The <see cref="PagingArgs"/>.</param> /// <returns>A <see cref="ProductCollectionResult"/>.</returns> public Task <ProductCollectionResult> GetByArgsAsync(ProductArgs args, PagingArgs paging) { return(ManagerInvoker.Default.InvokeAsync(this, async() => { ExecutionContext.Current.OperationType = OperationType.Read; EntityBase.CleanUp(args); if (_getByArgsOnPreValidateAsync != null) { await _getByArgsOnPreValidateAsync(args, paging); } MultiValidator.Create() .Add(args.Validate(nameof(args)).Entity(ProductArgsValidator.Default)) .Additional((__mv) => _getByArgsOnValidate?.Invoke(__mv, args, paging)) .Run().ThrowOnError(); if (_getByArgsOnBeforeAsync != null) { await _getByArgsOnBeforeAsync(args, paging); } var __result = await ProductDataSvc.GetByArgsAsync(args, paging); if (_getByArgsOnAfterAsync != null) { await _getByArgsOnAfterAsync(__result, args, paging); } Cleaner.Clean(__result); return __result; })); }
public IActionResult GetByArgs(string?name = default, string?description = default) { var args = new ProductArgs { Name = name, Description = description }; return(new WebApiGet <ProductCollectionResult, ProductCollection, Product>(this, () => _manager.GetByArgsAsync(args, WebApiQueryString.CreatePagingArgs(this)), operationType: OperationType.Read, statusCode: HttpStatusCode.OK, alternateStatusCode: HttpStatusCode.NoContent)); }
/// <summary> /// Gets the <see cref="Product"/> collection object that matches the selection criteria. /// </summary> /// <param name="args">The Args (see <see cref="ProductArgs"/>).</param> /// <param name="paging">The <see cref="PagingArgs"/>.</param> /// <returns>A <see cref="ProductCollectionResult"/>.</returns> public Task <ProductCollectionResult> GetByArgsAsync(ProductArgs args, PagingArgs paging) { return(DataInvoker.Default.InvokeAsync(this, async() => { ProductCollectionResult __result = new ProductCollectionResult(paging); var __dataArgs = ODataMapper.Default.CreateArgs(__result.Paging); if (_getByArgsOnBeforeAsync != null) { await _getByArgsOnBeforeAsync(args, __dataArgs).ConfigureAwait(false); } __result.Result = await TestOData.Default.SelectQueryAsync <ProductCollection, Product>(__dataArgs, q => _getByArgsOnQuery == null ? q : _getByArgsOnQuery(q, args, __dataArgs)).ConfigureAwait(false); if (_getByArgsOnAfterAsync != null) { await _getByArgsOnAfterAsync(__result, args).ConfigureAwait(false); } return __result; }, new BusinessInvokerArgs { ExceptionHandler = _getByArgsOnException })); }
/// <summary> /// Gets the <see cref="Product"/> collection object that matches the selection criteria. /// </summary> /// <param name="args">The Args (see <see cref="ProductArgs"/>).</param> /// <param name="paging">The <see cref="PagingArgs"/>.</param> /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param> /// <returns>A <see cref="WebApiAgentResult"/>.</returns> public Task <WebApiAgentResult <ProductCollectionResult> > GetByArgsAsync(ProductArgs args, PagingArgs paging = null, WebApiRequestOptions requestOptions = null) { return(base.GetCollectionResultAsync <ProductCollectionResult, ProductCollection, Product>("api/v1/products", requestOptions: requestOptions, args: new WebApiArg[] { new WebApiArg <ProductArgs>("args", args, WebApiArgType.FromUriUseProperties), new WebApiPagingArgsArg("paging", paging) })); }
private IBoundClient <Model.Product> GetByArgs_OnQuery(IBoundClient <Model.Product> q, ProductArgs args, IODataArgs _) { return(q.FilterWildcard(p => p.Name, args?.Name) .FilterWildcard(p => p.Description, args?.Description)); }
private IQueryable <Product> GetByArgs_OnQuery(IQueryable <Product> q, ProductArgs args, IODataArgs da) { return(q.WhereWildcard(p => p.Name, args?.Name) .WhereWildcard(p => p.Description, args?.Description)); }
/// <summary> /// Gets the <see cref="Product"/> collection object that matches the selection criteria. /// </summary> /// <param name="args">The Args (see <see cref="ProductArgs"/>).</param> /// <param name="paging">The <see cref="PagingArgs"/>.</param> /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param> /// <returns>A <see cref="WebApiAgentResult"/>.</returns> public Task <WebApiAgentResult <ProductCollectionResult> > GetByArgsAsync(ProductArgs args, PagingArgs paging = null, WebApiRequestOptions requestOptions = null) { return(ProductServiceAgent.GetByArgsAsync(args, paging, requestOptions)); }