public async Task <IActionResult> GetServiceQuestionsById([FromQuery] ServiceQuestionServiceTypeParameters serviceQuestionServiceTypeParameters) { var getServiceQuestionByIdServiceTypeQuery = new GetServiceQuestionsByIdQuery(serviceQuestionServiceTypeParameters); var result = await mediator.Send(getServiceQuestionByIdServiceTypeQuery); return(StatusCode((int)result.Code, result.Value)); }
public async Task <List <Servicequestion> > GetServiceQuestionsById(ServiceQuestionServiceTypeParameters serviceQuestionServiceTypeParameters) { var getServiceQuestionParameters = new object[] { new MySqlParameter("@limit", serviceQuestionServiceTypeParameters.PageSize), new MySqlParameter("@offset", (serviceQuestionServiceTypeParameters.PageNumber - 1) * serviceQuestionServiceTypeParameters.PageSize), new MySqlParameter("@IsForVendor", serviceQuestionServiceTypeParameters.IsForVendor), new MySqlParameter("@ServiceType", serviceQuestionServiceTypeParameters.ServiceType), }; return(await FindAll("CALL SpSelectActiveServiceQuestion(@limit, @offset,@IsForVendor,@ServiceType)", getServiceQuestionParameters).ToListAsync()); }
public async Task <APIResponse> GetServiceQuestionsById(ServiceQuestionServiceTypeParameters serviceQuestionServiceTypeParameters) { try { string serializedStories; // List<AssetResponse> stories; /* var encodedStories = await distributedCache.GetAsync(BlogServiceOperation.GetStoriesCacheName); * * if (encodedStories != null) * { * serializedStories = Encoding.UTF8.GetString(encodedStories); * stories = JsonConvert.DeserializeObject<List<StoryResponse>>(serializedStories); * } * else * {*/ var client = httpClientFactory.CreateClient(VendorServiceOperation.serviceName); UriBuilder url = new UriBuilder(servicesConfig.Vendor + VendorServiceOperation.GetServiceQuestionsById()); url.Query = QueryStringHelper.ConvertToQueryString(serviceQuestionServiceTypeParameters); var response = await client.GetAsync(url.ToString()); var assets = JsonConvert.DeserializeObject <ServiceQuestionResponse>(await response.Content.ReadAsStringAsync()); serializedStories = JsonConvert.SerializeObject(assets); /* encodedStories = Encoding.UTF8.GetBytes(serializedStories); * var options = new DistributedCacheEntryOptions() * .SetSlidingExpiration(TimeSpan.FromMinutes(1)) * .SetAbsoluteExpiration(DateTime.Now.AddHours(1)); * * await distributedCache.SetAsync(VendorServiceOperation.GetStoriesCacheName, encodedStories, options);*/ // } return(new APIResponse(assets, HttpStatusCode.OK)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'GetAllBranches()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }
/// <summary> /// Initializes a new instance of the <see cref="GetAllServiceQuestionByServiceTypeQuery"/> class. /// </summary> /// <param name="serviceTypeId">The service type identifier.</param> public GetServiceQuestionsByIdQuery(ServiceQuestionServiceTypeParameters serviceQuestionServiceTypeParameters) { this.serviceQuestionServiceTypeParameters = serviceQuestionServiceTypeParameters; }
public async Task <IActionResult> GetServiceQuestionsById([FromQuery] ServiceQuestionServiceTypeParameters serviceQuestionServiceTypeParameters) { var result = await serviceQuestionService.GetServiceQuestionsById(serviceQuestionServiceTypeParameters); return(StatusCode((int)result.Code, result.Value)); }