예제 #1
0
        public OngViewModel Atualizar(OngViewModel ongViewModel)
        {
            var ong = Mapper.Map <Ong>(ongViewModel);

            _ongService.Atualizar(ong);
            ong.Ativo = true;
            Commit();
            return(ongViewModel);
        }
예제 #2
0
        public IActionResult Atualizar(OngViewModel ongViewModel, int id)
        {
            if (id != ongViewModel.Id)
            {
                NotificarErro("Os ids informados não são idênticos!");
                Retorno();
            }
            if (!ModelState.IsValid)
            {
                return(Retorno(ongViewModel));
            }


            return(Retorno(_ongService.Atualizar(ongViewModel, id)));
        }
예제 #3
0
        public IActionResult Editar(int id, OngViewModel ong)
        {
            if (id != ong.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _ongService.Atualizar(ong, id);
                }
                catch (DbUpdateConcurrencyException)
                {
                    throw;
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ong));
        }