public ActionResult DeleteConfirmed(int id)
        {
            Candidatocargo cANDIDATOCARGO = db.Candidatocargo.Find(id);

            db.Candidatocargo.Remove(cANDIDATOCARGO);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,Candidato_Id,Cargo_Id,DataCriacao")] Candidatocargo cANDIDATOCARGO)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cANDIDATOCARGO).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Cargo_Id     = new SelectList(db.Cargos, "Id", "Nome", cANDIDATOCARGO.Cargo_Id);
     ViewBag.Candidato_Id = new SelectList(db.Pessoas, "Id", "nome", cANDIDATOCARGO.Candidato_Id);
     return(View(cANDIDATOCARGO));
 }
        // GET: CandidatoCargo/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Candidatocargo cANDIDATOCARGO = db.Candidatocargo.Find(id);

            if (cANDIDATOCARGO == null)
            {
                return(HttpNotFound());
            }
            return(View(cANDIDATOCARGO));
        }
        // GET: CandidatoCargo/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Candidatocargo cANDIDATOCARGO = db.Candidatocargo.Find(id);

            if (cANDIDATOCARGO == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Cargo_Id     = new SelectList(db.Cargos, "Id", "Nome", cANDIDATOCARGO.Cargo_Id);
            ViewBag.Candidato_Id = new SelectList(db.Pessoas, "Id", "nome", cANDIDATOCARGO.Candidato_Id);
            return(View(cANDIDATOCARGO));
        }
        public ActionResult Create([Bind(Include = "Id,Candidato_Id,Cargo_Id,DataCriacao")] Candidatocargo cANDIDATOCARGO)
        {
            cANDIDATOCARGO.Id          = GetHashCode();
            cANDIDATOCARGO.DataCriacao = DateTime.Now;
            if (ModelState.IsValid)
            {
                db.Candidatocargo.Add(cANDIDATOCARGO);
                db.SaveChanges();
                return(RedirectToAction("Index/" + cANDIDATOCARGO.Candidato_Id));
            }

            ViewBag.Candidato_Id = cANDIDATOCARGO.Pessoas;
            ViewBag.Cargo_Id     = new SelectList(db.Cargos, "Id", "Nome", cANDIDATOCARGO.Cargo_Id);
            ViewBag.Candidato    = new SelectList(db.Pessoas, "Id", "nome", cANDIDATOCARGO.Candidato_Id);
            return(View(cANDIDATOCARGO));
        }