public async Task <IActionResult> Create([Bind("Id,Nome,Email")] Dentista dentista)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dentista);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(dentista));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,Numero,Codigo")] Sala sala)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sala);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sala));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Id,Nome,Email")] Paciente paciente,
                                                 [Bind("Logradouro, Numero, Bairro, Cidade, Estado, CEP")] Endereco endereco,
                                                 [Bind("Tipo, Telefone")] List <Contato> contato)
        {
            if (ModelState.IsValid)
            {
                paciente.Endereco            = endereco;
                paciente.Contato             = contato;
                paciente.Endereco.PacienteId = paciente.Id;
                foreach (var c in paciente.Contato)
                {
                    c.PacienteId = paciente.Id;
                }
                _context.Add(paciente);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(paciente));
        }