コード例 #1
0
        public ActionResult EditarContatos(int id)
        {
            var dados = AgendaContatosService.GetById(id);

            var saida = new ListaContatosViewModel(dados);

            return(View(saida));
        }
コード例 #2
0
        public ActionResult CadastrarContatos(ListaContatosViewModel Itens)
        {
            try
            {
                Itens.Status = true;
                AgendaContatosService.Add(Itens.ToDomain());

                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
コード例 #3
0
        public ActionResult BuscarContatos()
        {
            var saida = new List <ListaContatosViewModel>();

            var listagemContatos = AgendaContatosService.GetAll();

            foreach (var item in listagemContatos)
            {
                var registro = new ListaContatosViewModel(item);
                saida.Add(registro);
            }

            return(View("_Lista", saida));
        }
コード例 #4
0
        public ActionResult EditarContatos(ListaContatosViewModel Itens)
        {
            try
            {
                Itens.Status = true;
                AgendaContatosService.Update(Itens.ToDomain());


                return(RedirectToAction("Index", "Home"));
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
        }