示例#1
0
        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));
        }
示例#2
0
        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());
        }
示例#3
0
        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));
            }
        }
示例#4
0
 /// <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));
        }