public async Task <IActionResult> Edit(int id, [Bind("Id,HoraAtendimento,TempoAtemdimento,DentistaId,PacienteId,SecretariaId")] Agendamento agendamento)
        {
            if (id != agendamento.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _agendaOdontologica.Update(agendamento);
                    await _agendaOdontologica.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AgendamentoExists(agendamento.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DentistaId"]   = new SelectList(_agendaOdontologica.Dentistas, "Id", "Id", agendamento.DentistaId);
            ViewData["PacienteId"]   = new SelectList(_agendaOdontologica.Pacientes, "Id", "Id", agendamento.PacienteId);
            ViewData["SecretariaId"] = new SelectList(_agendaOdontologica.Secretarias, "Id", "Id", agendamento.SecretariaId);
            return(View(agendamento));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,HomeLoginId,NivelAcessoId")] UsuariosRoles usuariosRoles)
        {
            if (id != usuariosRoles.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(usuariosRoles);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsuariosRolesExists(usuariosRoles.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(usuariosRoles));
        }
        //[Authorize(Roles = "Administrador")]
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,DataNaci,DataAdmissao,Login,Senha,CPF,Endereco,CEP,PIS")] Secretaria secretaria)
        {
            if (id != secretaria.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _agendaOdontologica.Update(secretaria);
                    await _agendaOdontologica.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SecretariaExists(secretaria.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(secretaria));
        }
        //[Authorize(Roles = "Administrador")]
        public async Task <IActionResult> Edit(int id, [Bind("Id,Especialidade")] Especializacao especializacao)
        {
            if (id != especializacao.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _agendaOdontologica.Update(especializacao);
                    await _agendaOdontologica.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EspecializacaoExists(especializacao.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(especializacao));
        }
        public async Task <IActionResult> Edit(string id, [Bind("Descricao,Id,Name,NormalizedName,ConcurrencyStamp")] NivelAcesso nivelAcesso)
        {
            if (id != nivelAcesso.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _agendaOdontologica.Update(nivelAcesso);
                    await _agendaOdontologica.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NivelAcessoExists(nivelAcesso.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(nivelAcesso));
        }
        //[Authorize(Roles = "Administrador")]
        public async Task <IActionResult> Edit(int id, [Bind("Id,NomePaciente,RG,CPF,Endereço,CEP,ValorTratamento,FormaDePagamento")] Paciente paciente)
        {
            if (id != paciente.Id)
            {
                return(NotFound());
            }

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