public async Task <IActionResult> Create([Bind("CargoId,NomeCargo,Descricao,NivelCargo")] Cargo cargo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cargo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cargo));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("DepartamentoId,NomeDepartamento")] Departamento departamento)
        {
            if (ModelState.IsValid)
            {
                _context.Add(departamento);
                await _context.SaveChangesAsync();

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

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CargoId"] = new SelectList(_context.Cargo, "CargoId", "NomeCargo", tarefa.CargoId);
            return(View(tarefa));
        }
        public async Task <IActionResult> Create([Bind("ProfessorId,Nome,Contacto,DataNascimento,GeneroId,DepartamentoId")] Professor professor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(professor);
                await _context.SaveChangesAsync();

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

            return(View(professor));
        }
Exemple #5
0
        public async Task <IActionResult> Create([Bind("FuncionarioId,Nome,Contacto,DataNascimento,GeneroId,CargoId")] Funcionario funcionario)
        {
            if (ModelState.IsValid)
            {
                _context.Add(funcionario);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CargoId"]  = new SelectList(_context.Cargo, "CargoId", "NomeCargo", funcionario.CargoId);
            ViewData["GeneroId"] = new SelectList(_context.Genero, "GeneroId", "Genero", funcionario.GeneroId);
            return(View(funcionario));
        }
Exemple #6
0
        public async Task <IActionResult> Create([Bind("TarFuncId,FuncionarioId,TarefaId")] TarFunc tarFunc)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tarFunc);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FuncionarioId"] = new SelectList(_context.Funcionario, "FuncionarioId", "Nome", tarFunc.FuncionarioId);
            ViewData["TarefaId"]      = new SelectList(_context.Tarefa, "TarefaId", "DescricaoTarefa", tarFunc.TarefaId);
            return(View(tarFunc));
        }
        public async Task <IActionResult> Create([Bind("TFCId,CargoID,FuncionarioId,TarefaId")] TFC tFC)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tFC);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CargoID"]       = new SelectList(_context.Cargo, "CargoId", "NomeCargo", tFC.CargoID);
            ViewData["FuncionarioId"] = new SelectList(_context.Funcionario, "FuncionarioId", "Nome", tFC.FuncionarioId);
            ViewData["TarefaId"]      = new SelectList(_context.Tarefa, "TarefaId", "NomeTarefa", tFC.TarefaId);
            return(View(tFC));
        }