public async Task <HttpResponseMessage> EdicionDetalle(MCDetCargaForDosEdicionRequest request, string baseUrl)
        {
            HttpResponseMessage response = null;

            try
            {
                using (var client = new HttpClient())
                {
                    var data = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json");
                    response = await client.PutAsync(baseUrl + "actividad/edicion", data);
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }
            return(response);
        }
        public async Task <IActionResult> EdicionDetalle(MCDetCargaForDosEdicionRequest request)
        {
            try
            {
                var detCargaActividadBus = new MCDetCargaForDosBus();

                string baseUrl = this.configuration.GetSection("AppSettings").GetSection("Servicio").Value;

                var response = await detCargaActividadBus.EdicionDetalle(request, baseUrl);

                if (response != null)
                {
                    if (response.IsSuccessStatusCode)
                    {
                        var detCargaActividadEdicion = JsonConvert.DeserializeObject <MCDetCargaForDosEdicionResponse>(response.Content.ReadAsStringAsync().Result);

                        if (detCargaActividadEdicion.Exito)
                        {
                            ViewBag.MensajeExito = detCargaActividadEdicion.Mensaje;
                        }
                        else
                        {
                            ViewBag.MensajeError = detCargaActividadEdicion.Mensaje;
                        }

                        var detCargaActividadBusquedaEdicion = new MCDetCargaForDosBusquedaEdicionResponse
                        {
                            CodigoDetalle  = request.CodigoDetalle,
                            Ruc            = request.Ruc,
                            RazonSocial    = request.RazonSocial,
                            ZonaEspecifica = request.ZonaEspecifica,
                            Prioridad      = request.Prioridad,
                            PermisoInt     = request.PermisoInt
                        };

                        return(View("EdicionAccion", detCargaActividadBusquedaEdicion));
                    }
                    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 <IActionResult> EdicionDetalle(MCDetCargaForDosEdicionRequest request)
        {
            try
            {
                var detCargaActividadBus = new MCDetCargaForDosBus();

                string baseUrl = this.configuration.GetSection("AppSettings").GetSection("Servicio").Value;

                var    IP       = Request.HttpContext.Connection.RemoteIpAddress;
                string compName = DetermineCompName(IP.ToString());

                if (request.Ruc == null)
                {
                    request.Ruc = " ";
                }


                request.NombreTerminal = compName;
                var response = await detCargaActividadBus.EdicionDetalle(request, baseUrl);

                if (response != null)
                {
                    if (response.IsSuccessStatusCode)
                    {
                        var detCargaActividadEdicion = JsonConvert.DeserializeObject <MCDetCargaForDosEdicionResponse>(response.Content.ReadAsStringAsync().Result);

                        if (detCargaActividadEdicion.Exito)
                        {
                            ViewBag.MensajeExito = detCargaActividadEdicion.Mensaje;
                        }
                        else
                        {
                            ViewBag.MensajeError = detCargaActividadEdicion.Mensaje;
                        }

                        var detCargaActividadBusquedaEdicion = new MCDetCargaForDosBusquedaEdicionResponse
                        {
                            NumCarga       = request.NumCarga,
                            CodigoDetalle  = request.CodigoDetalle,
                            Ruc            = request.Ruc,
                            RazonSocial    = request.RazonSocial,
                            ZonaEspecifica = request.ZonaEspecifica,
                            Prioridad      = request.Prioridad,
                            PermisoInt     = request.PermisoInt,
                            Trabajadores   = request.Trabajadores
                        };
                        ViewData["ListaPrioridades"] = ListarValores_x_ICodParametro();
                        ViewData["Trabajadores"]     = ListarTrabajadores_Carga(request.NumCarga, request.CodigoDetalle);
                        return(View("EdicionAccion", detCargaActividadBusquedaEdicion));
                    }
                    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"));
        }