Exemple #1
0
        public async Task <IActionResult> Create([Bind("CargosId,NomeCargo,Funcao")] Cargos cargos)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cargos);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cargos));
        }
        public async Task <IActionResult> Create([Bind("ProfessorId,Nome,Telemovel,Email,Gabinete,Disciplina")] Professor professor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(professor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(professor));
        }
        public async Task <IActionResult> Create([Bind("EscolaId,NomeEscola")] Escola escola)
        {
            if (ModelState.IsValid)
            {
                _context.Add(escola);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(escola));
        }
        public async Task <IActionResult> Create([Bind("FuncionarioId,Nome,Numero,Escola,Morada,Email,Telemovel,NIF")] Funcionario funcionario)
        {
            if (ModelState.IsValid)
            {
                _context.Add(funcionario);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(funcionario));
        }
Exemple #5
0
        public async Task <IActionResult> Create([Bind("professoresId,Nome,Numero,Email")] Professores professores)
        {
            if (ModelState.IsValid)
            {
                _context.Add(professores);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(professores));
        }
        public async Task <IActionResult> Create([Bind("TarefaId,NomeTarefa,DataTarefa,FuncionarioId")] Tarefa tarefa)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tarefa);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FuncionarioId"] = new SelectList(_context.Funcionarios, "FuncionarioId", "Nome", tarefa.FuncionarioId);
            return(View(tarefa));
        }
        public async Task <IActionResult> Create([Bind("FuncionarioId,Nome,Email,CargosId")] Funcionario funcionario)
        {
            if (ModelState.IsValid)
            {
                _context.Add(funcionario);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CargosId"] = new SelectList(_context.Cargos, "CargosId", "Funcao", funcionario.CargosId);
            return(View(funcionario));
        }