public ActionResult Edit(ViewModelEditCategoria viewModelEdit) { if (!ModelState.IsValid) return View(viewModelEdit); try { using (_aplicacao) _aplicacao.Update(Mapper.Map<ViewModelEditCategoria, Categoria>(viewModelEdit)); return RedirectToAction("Index"); } catch (MyException ex) { ViewBag.Alerta = new Alerta(ex.Message, TipoDeAlerta.Aviso); } return View(viewModelEdit); }
public void Edit(int id, string nome, bool ativo) { var viewModelCreate = new ViewModelEditCategoria() { Id = id, Nome = nome, Ativo = ativo }; var view = _controller.Edit(viewModelCreate); Assert.IsNotNull(view); }