public ActionResult Editar(UsuarioDepartamentoEntity model) { if (ModelState.IsValid) { try { new UsuarioDepartamentoBusiness().Salvar(model, this.UsuarioId); return(RedirectToAction("Index")); } catch (TicketException ex) { ModelState.AddModelError("ex", ex.Message); } } return(View(model)); }
//usuario cadastro public void Salvar(UsuarioDepartamentoEntity entity, int usuarioId) { try { using (SynsTicketContext context = new SynsTicketContext()) { base.SaveChanges(entity, usuarioId, true, context); } } catch (TicketException ex) { this.Erros.Add(ex); } finally { if (this.Erros.Count > 0) { throw new TicketException(this.ConsisteErros()); } } }