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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cargo));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("TipoId,TipoNome")] TipoTarefa tipoTarefa)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tipoTarefa);
                await _context.SaveChangesAsync();

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

                ViewBag.Mensagem = "Departamento adicionado com sucesso";
                return(View("Success"));
            }
            return(View(departamento));
        }
        public async Task <IActionResult> Create([Bind("ServicoId,Nome")] Servico servico)
        {
            if (ModelState.IsValid)
            {
                _context.Add(servico);
                await _context.SaveChangesAsync();

                return(View("NoteCriarS", servico));
                //return RedirectToAction(nameof(Index));
            }
            return(View(servico));
        }
Beispiel #5
0
        public async Task <IActionResult> Create([Bind("DepartamentoId,Nome")] Departamento departamento)
        {
            if (ModelState.IsValid)
            {
                _context.Add(departamento);
                await _context.SaveChangesAsync();

                //return RedirectToAction(nameof(Index));
                return(View("Note", departamento));
            }
            return(View(departamento));
        }
Beispiel #6
0
        public async Task <IActionResult> Create([Bind("TarefaId,NomeTarefa,NomeOrdena,FuncionarioId,DataInicio,DataFim,TipoId,Descricao,estadoTarefa")] Tarefa tarefa)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tarefa);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FuncionarioId"] = new SelectList(_context.Funcionario, "FuncionarioId", "Nome", tarefa.FuncionarioId);
            ViewData["TipoId"]        = new SelectList(_context.TipoTarefa, "TipoId", "TipoMome", tarefa.TipoId);
            return(View(tarefa));
        }
Beispiel #7
0
        public async Task <IActionResult> Create([Bind("FuncionarioId,Nome,Telemovel,CC,Email,CargoId,DepartamentoId")] Funcionario funcionario)
        {
            if (ModelState.IsValid)
            {
                _context.Add(funcionario);
                await _context.SaveChangesAsync();

                //return RedirectToAction(nameof(Index));
                return(View("Note", funcionario));
            }
            ViewData["CargoId"]        = new SelectList(_context.Cargo.OrderBy(c => c.Nome), "CargoId", "Nome", funcionario.CargoId);
            ViewData["DepartamentoId"] = new SelectList(_context.Departamento.OrderBy(d => d.Nome), "DepartamentoId", "Nome", funcionario.DepartamentoId);
            return(View(funcionario));
        }
Beispiel #8
0
        public async Task <IActionResult> Create([Bind("FuncionarioId,Nome,SobreNome,Sexo,NTelemovel,Email,DepartamentoId,CargoId")] Funcionario funcionario)
        {
            if (ModelState.IsValid)
            {
                _context.Add(funcionario);
                await _context.SaveChangesAsync();

                ViewBag.Mensagem = "Funcionario adicionado com sucesso";
                return(View("Success"));
            }



            ViewData["DepartamentoId"] = new SelectList(_context.Departamento, "DepartamentoId", "Nome", funcionario.DepartamentoId);
            ViewData["CargoId"]        = new SelectList(_context.Cargo, "CardoId", "NomeCargo", funcionario.CargoId);


            return(View(funcionario));
        }