public async Task <IActionResult> Edit(int id, [Bind("LocadorId,Status,Nome,SobreNome,Cpf,Rg,OrgaoEmissor,Profissao,EstadoCivil,Email,Tel,TelTestemunha")] Locador locador) { if (id != locador.LocadorId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(locador); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocadorExists(locador.LocadorId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(locador)); }
public async Task <IActionResult> Edit(int id, [Bind("ContratoId,LocadorId,LocatarioId,imovelId,DataContrato,DiaVencimentoAlguel,DataInicio,DataFim,Status")] Contrato contrato) { if (id != contrato.ContratoId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(contrato); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContratoExists(contrato.ContratoId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["imovel"] = new SelectList(_context.Imovels, "ImovelId", "NomeImovel", contrato.imovelId); ViewData["Locador"] = new SelectList(_context.Locadores, "LocadorId", "Nome", contrato.LocadorId); ViewData["Locatario"] = new SelectList(_context.Locatarios, "LocatarioId", "Nome", contrato.LocatarioId); return(View(contrato)); }
public async Task <IActionResult> Edit(int id, [Bind("ImovelId,NomeImovel,Cidade,Estado,Bairro,Rua,Numero,Cep,Status")] Imovel imovel) { if (id != imovel.ImovelId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(imovel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ImovelExists(imovel.ImovelId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(imovel)); }