public bool Atualizar(TelefoneViewModel telefoneViewModel) { var Telefone = Mapper.Map <TelefoneViewModel, Telefone>(telefoneViewModel); BeginTransaction(); _telefoneService.Atualizar(Telefone); Commit(); return(true); }
public bool Excluir(int id) { bool existente = _empresaService.Find(e => e.EmpresaId == id).Any(); var empresa = _empresaService.ObterPorId(id); List <Telefone> telefones = new List <Telefone>(); foreach (var item in empresa.Telefones) { item.Delete = true; telefones.Add(item); } empresa.Endereco.Delete = true; if (existente) { BeginTransaction(); empresa.Delete = true; _empresaService.Atualizar(empresa); _enderecoService.Atualizar(empresa.Endereco); foreach (var item in telefones) { _telefoneService.Atualizar(item); } Commit(); return(true); } return(false); }
public ActionResult Edit(Telefone telefone) { if (ModelState.IsValid) { _service.Atualizar(telefone); return(RedirectToAction("Index", "Pessoa")); } return(View(telefone)); }
public Telefone Atualizar(Telefone obj) { return(_telefoneService.Atualizar(obj)); }