public JsonResult ObtenerPaises(PaisViewModel f)
        {
            using (var client = new IntranetEntities())
            {
                var res = client.spObtenerPaises(f.Activo, f.Nombre, f.Codigo, f.PaisID).ToList();

                return(Json(res, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 2
0
        public static IEnumerable <SelectListItem> ObtenerPaises()
        {
            using (var client = new IntranetEntities())
            {
                var res = client.spObtenerPaises(null, null, null, null).ToList()
                          .Select(p => new SelectListItem
                {
                    Selected = false,
                    Text     = p.Nombre,
                    Value    = p.PaisID.ToString()
                });


                return(res);
            }
        }
        public ActionResult PaisEditar(int?PaisID, string Accion)
        {
            using (var client = new IntranetEntities())
            {
                if (Accion == "A")
                {
                    return(PartialView("~/Views/Catalogo/Pais/EditarPais.cshtml", new PaisViewModel {
                        Accion = Accion
                    }));
                }
                else
                {
                    var res = client.spObtenerPaises(null, null, null, PaisID);

                    var model = new PaisViewModel(res.FirstOrDefault());

                    model.Accion = Accion;

                    return(PartialView("~/Views/Catalogo/Pais/EditarPais.cshtml", model));
                }
            }
        }