Ejemplo n.º 1
0
        public ActionResult Edit(CargoUser cargoUser)
        {
            try
            {
                CargoUserRepository repository = new();
                repository.Update(cargoUser);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 2
0
        public ActionResult Delete(int id, CargoUser cargoUser)
        {
            try
            {
                CargoUserRepository repository = new();
                repository.Delete(cargoUser);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 3
0
        public ActionResult Create([Bind] CargoUser cargoUsuario)
        {
            try
            {
                CargoRepository cargoRepository = new();
                Cargo           cargo           = cargoRepository.ProcurarCargo(cargoUsuario.Cargo.Nome);

                CandidateRepository candidateRepository = new();
                Candidate           candidate           = candidateRepository.BuscarPorCPF(cargoUsuario.Candidate.CPF);

                cargoUsuario.Cargo.Id     = cargo.Id;
                cargoUsuario.Candidate.Id = candidate.Id;

                CargoUserRepository repository = new();
                repository.Add(cargoUsuario);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }