public async Task <IActionResult> BusquedaEdicionDetalle(MCDetCargaForDosBusquedaEdicionRequest request) { try { var detCargaActividadBus = new MCDetCargaForDosBus(); string baseUrl = this.configuration.GetSection("AppSettings").GetSection("Servicio").Value; var response = await detCargaActividadBus.BusquedaEdicionDetalle(request, baseUrl); ViewData["ListaPrioridades"] = ListarValores_x_ICodParametro(); ViewData["Trabajadores"] = ListarTrabajadores_Carga(request.NumCarga, request.CodigoDetalle); if (response != null) { if (response.IsSuccessStatusCode) { //string jsonResponse = await response.Content.ReadAsStringAsync(); //var detCargaActividadEdicion = JsonConvert.DeserializeObject<List<MCDetCargaForDosBusquedaEdicionResponse>>(jsonResponse); var detCargaActividadEdicion = JsonConvert.DeserializeObject <MCDetCargaForDosBusquedaEdicionResponse>(response.Content.ReadAsStringAsync().Result); return(View("EdicionAccion", detCargaActividadEdicion)); } else { switch (response.StatusCode) { case HttpStatusCode.InternalServerError: var mensajeErrorInterno = JsonConvert.DeserializeObject <ErrorInternoResponse>(response.Content.ReadAsStringAsync().Result); Console.Write("Error"); break; case HttpStatusCode.UnprocessableEntity: var mensajeEntidadImprosesable = JsonConvert.DeserializeObject <ErrorInternoResponse>(response.Content.ReadAsStringAsync().Result); Console.Write("Error"); break; default: Console.Write("Error"); break; } } } else { Console.Write("Error"); } } catch (Exception ex) { Console.Write("Error"); } return(Content("Ups! Un error ocurrio")); }
public async Task <HttpResponseMessage> BusquedaEdicionDetalle(MCDetCargaForDosBusquedaEdicionRequest request, string baseUrl) { HttpResponseMessage response = null; try { using (var client = new HttpClient()) { response = await client.GetAsync(baseUrl + "actividad/" + request.NumCarga + "," + request.CodigoDetalle); } } catch (Exception ex) { Console.Write(ex); } return(response); }