public async Task <IActionResult> Edit(int id, [Bind("Cidade,Logradouro,Cep,EstadoId,Id")] Endereco endereco)
        {
            if (id != endereco.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(endereco);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnderecoExists(endereco.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EstadoId"] = new SelectList(_context.Set <Estado>(), "Id", "Id", endereco.EstadoId);
            return(View(endereco));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Sigla,Nome,Id")] Estado estado)
        {
            if (id != estado.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(estado);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EstadoExists(estado.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(estado));
        }
        public async Task <IActionResult> Edit(int id, [Bind("horaInicio,horaFim,atendePlano,atendeDia,Id")] Atendimento atendimento)
        {
            if (id != atendimento.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(atendimento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AtendimentoExists(atendimento.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(atendimento));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(long id, [Bind("ID,Data")] Consulta consulta)
        {
            if (id != consulta.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(consulta);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConsultaExists(consulta.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(consulta));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Nome,Sexo,Nascimento,EnderecoId,Id")] Paciente paciente)
        {
            if (id != paciente.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(paciente);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PacienteExists(paciente.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EnderecoId"] = new SelectList(_context.Set <Endereco>(), "Id", "Id", paciente.EnderecoId);
            return(View(paciente));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Nome,Crm,Tel,Atendimentos,Id")] Medico medico)
        {
            if (id != medico.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(medico);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MedicoExists(medico.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(medico));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Nome,Descricao,Valor,Id")] Exame exame)
        {
            if (id != exame.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(exame);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExameExists(exame.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(exame));
        }