예제 #1
0
        public IActionResult Edit(int?id)
        {
            var personaVM = new PersonaViewModel();

            try
            {
                if (id == null)
                {
                    return(View("Error"));
                }

                var personaDB = _personaService.GetPersona(id);

                if (personaDB == null)
                {
                    return(View("Error"));
                }

                personaVM = new PersonaViewModel
                {
                    Persona   = personaDB,
                    Provincia = _provinciaService.GetAll()
                };
            }
            catch (Exception)
            {
                return(View("Error"));
            }

            return(View(personaVM));
        }
예제 #2
0
        public IActionResult Index()
        {
            var provinciaVM = new List <ProvinciaViewModel>();
            var provinciaDB = _provinciaService.GetAll();

            foreach (var item in provinciaDB)
            {
                provinciaVM.Add(new ProvinciaViewModel
                {
                    Provincia = item
                });
            }
            return(View(provinciaVM));
        }
예제 #3
0
 public IList <ProvinciaDTO> Get()
 {
     return(Service.GetAll());
 }