예제 #1
0
        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));
        }
예제 #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));
        }
예제 #3
0
        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));
        }
예제 #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));
        }
예제 #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));
        }
예제 #7
0
        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));
        }