public async Task <APIResponse> GetLeadStatus(int leadId, LeadStatusParameter leadStatusParameter) { try { var client = httpClientFactory.CreateClient(LeadServiceOperation.serviceName); UriBuilder url = new UriBuilder(servicesConfig.Lead + LeadServiceOperation.GetLeadStatus(leadId)); url.Query = QueryStringHelper.ConvertToQueryString(leadStatusParameter); var response = await client.GetAsync(url.ToString()); if (response.IsSuccessStatusCode) { var leadStatus = JsonConvert.DeserializeObject <List <LeadStatusResponse> >(await response.Content.ReadAsStringAsync()); return(new APIResponse(leadStatus, HttpStatusCode.OK)); } return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'GetLeadStatus()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }
/// <summary> /// Gets the lead quotes. /// </summary> /// <param name="leadQuoteParameters">The lead quote parameters.</param> /// <returns></returns> public async Task <PagedList <Entity> > GetLeadStatus(LeadStatusParameter leadStatusParameter, int leadId = 0) { var leadStatusCollections = FindByCondition(x => x.Active == Convert.ToInt16(true) && x.LeadId.Equals(leadId)).ProjectTo <LeadStatusResponse>(mapper.ConfigurationProvider); var sortedStories = sortHelper.ApplySort(leadStatusCollections, leadStatusParameter.OrderBy); FilterByDate(ref sortedStories, leadStatusParameter.FromDate, leadStatusParameter.ToDate); var shapedStories = dataShaper.ShapeData(sortedStories, leadStatusParameter.Fields); return(await PagedList <Entity> .ToPagedList(shapedStories, leadStatusParameter.PageNumber, leadStatusParameter.PageSize)); }
public async Task <IActionResult> GetLeadStatus(int leadId, [FromQuery] LeadStatusParameter leadStatusParameter) { var getLeadStatusQuery = new GetAllLeadStatusQuery(leadStatusParameter, leadId); var result = await mediator.Send(getLeadStatusQuery); if (result.Code == HttpStatusCode.OK) { Response.Headers.Add("X-Pagination", PagedList <Entity> .ToJson(result.Value as PagedList <Entity>)); } return(StatusCode((int)result.Code, result.Value)); }
/// <summary> /// Initializes a new instance of the <see cref="GetAllLeadStatusQuery"/> class. /// </summary> /// <param name="leadStatusParameter">The lead status parameter.</param> /// <param name="leadId">The lead identifier.</param> public GetAllLeadStatusQuery(LeadStatusParameter leadStatusParameter, int leadId = 0) { LeadStatusParameter = leadStatusParameter; LeadId = leadId; }
public async Task <IActionResult> GetLeadStatus(int leadId, [FromQuery] LeadStatusParameter leadStatusParameters) { var result = await leadService.GetLeadStatus(leadId, leadStatusParameters); return(StatusCode((int)result.Code, result.Value)); }