public async Task <IActionResult> GetAllMultiDetails([FromQuery] MultiDetailParameters multiDetailParameters) { var getAllMultiDetailsQuery = new GetAllMultiDetailsQuery(multiDetailParameters); var result = await mediator.Send(getAllMultiDetailsQuery); return(StatusCode((int)result.Code, result.Value)); }
public async Task <APIResponse> GetMultiDetails(MultiDetailParameters multiDetailParameters) { try { var client = httpClientFactory.CreateClient(VendorServiceOperation.serviceName); UriBuilder url = new UriBuilder(servicesConfig.Vendor + VendorServiceOperation.GetMultiDetails()); url.Query = QueryStringHelper.ConvertToQueryString(multiDetailParameters); var response = await client.GetAsync(url.ToString()); if (response.IsSuccessStatusCode) { var multiDetail = JsonConvert.DeserializeObject <List <MultiDetailResponse> >(await response.Content.ReadAsStringAsync()); return(new APIResponse(multiDetail, HttpStatusCode.OK)); } return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'GetMultiDetails()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }
/// <summary> /// Gets all multicodes. /// </summary> /// <param name="multiDetailParameters">The multidetail parameters.</param> /// <returns></returns> public async Task <List <Multidetail> > GetMultiDetails(MultiDetailParameters multiDetailParameters) { var getMultiDetailParams = new object[] { new MySqlParameter("@p_Id", multiDetailParameters.Id), new MySqlParameter("@p_Code", string.Empty) }; var multidetails = await FindAll("CALL SpSelectActiveMultiDetail(@p_Id, @p_Code)", getMultiDetailParams).ToListAsync(); return(multidetails); }
public async Task <IActionResult> GetAllMultiDetails([FromQuery] MultiDetailParameters multiDetailParameters) { var getAllMultiDetailsQuery = new GetAllMultiDetailsQuery(multiDetailParameters); var result = await mediator.Send(getAllMultiDetailsQuery); 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> /// Gets all multicodes. /// </summary> /// <param name="multiDetailParameters">The multidetail parameters.</param> /// <returns></returns> public async Task <PagedList <Entity> > GetMultiDetails(MultiDetailParameters multiDetailParameters) { var getMultiDetailParams = new object[] { new MySqlParameter("@p_Id", multiDetailParameters.Id), new MySqlParameter("@p_Code", string.Empty) }; var multidetails = await FindAll("CALL SpSelectActiveMultiDetail(@p_Id, @p_Code)", getMultiDetailParams).ToListAsync(); var mappedmultidetails = multidetails.AsQueryable().ProjectTo <MultiDetailResponse>(mapper.ConfigurationProvider); //var sortedmultidetails = sortHelper.ApplySort(mappedmultidetails, multiDetailParameters.OrderBy); //var shapedmultidetails = dataShaper.ShapeData(sortedmultidetails, multiDetailParameters.Fields); var shapedmultidetails = dataShaper.ShapeData(mappedmultidetails, string.Empty); return(await PagedList <Entity> .ToPagedList(shapedmultidetails, 0, 0)); }
/// <summary> /// Initializes a new instance of the <see cref="GetAllMultiCodeQuery"/> class. /// </summary> /// <param name="storyParameters">The multidetail parameters.</param> public GetAllMultiDetailsQuery(MultiDetailParameters multiDetailParameters) { MultiDetailParameters = multiDetailParameters; }
public async Task <IActionResult> GetMultiDetails([FromQuery] MultiDetailParameters multiDetailParameters) { var result = await multiDetailService.GetMultiDetails(multiDetailParameters); return(StatusCode((int)result.Code, result.Value)); }