public async Task <IEnumerable <ProductStoreResponse> > ProductStoreQuery(ProductStoreRequest request) { return(await GetData("dbo.[ProductStoreQuery]", new List <SqlParameter> { new SqlParameter("@DataOrder", SqlDbType.VarChar) { Value = request.DataOrder.ToString() }, new SqlParameter("@FromDate", SqlDbType.VarChar) { Value = request.FromDate.ToString(DateFormat) }, new SqlParameter("@ToDate", SqlDbType.VarChar) { Value = request.ToDate.ToString(DateFormat) }, new SqlParameter("@DimensionType", SqlDbType.VarChar) { Value = request.DimensionType.ToString() }, new SqlParameter("@DimensionTypeValue", SqlDbType.Int) { Value = request.DimensionTypeValue }, new SqlParameter("@AggregateType", SqlDbType.VarChar) { Value = request.AggregateType.ToString() }, new SqlParameter("@DataPointType", SqlDbType.VarChar) { Value = request.DataPointType.DataPointToField() } }, reader => { var mapped = new List <ProductStoreResponse>(); while (reader.Read()) { mapped.Add(new ProductStoreResponse { Dimension = reader["Dimension"].ToString(), DataPoint = (decimal)reader["DataPoint"] }); } return mapped; } )); }
public async Task <IActionResult> GetProductStore(ProductStoreRequest request) { return(request.IsValid() ? (IActionResult)Json(await _dataContext.ProductStoreQuery(request)) : BadRequest()); }