Example #1
0
        public ActionResult voter(int?id)
        {
#pragma warning disable CS0246 // Le nom de type ou d'espace de noms 'ElectionDatabaseEntities' est introuvable (vous manque-t-il une directive using ou une référence d'assembly ?)
#pragma warning disable CS0246 // Le nom de type ou d'espace de noms 'ElectionDatabaseEntities' est introuvable (vous manque-t-il une directive using ou une référence d'assembly ?)
            ElectionDatabaseEntities dbcand = new ElectionDatabaseEntities();
#pragma warning restore CS0246 // Le nom de type ou d'espace de noms 'ElectionDatabaseEntities' est introuvable (vous manque-t-il une directive using ou une référence d'assembly ?)
#pragma warning restore CS0246 // Le nom de type ou d'espace de noms 'ElectionDatabaseEntities' est introuvable (vous manque-t-il une directive using ou une référence d'assembly ?)

            ElectionDatabaseEntities3 db = new ElectionDatabaseEntities3();
            // Electeur electeur = db.Electeur.Find(cni);

            ViewBag.prenom = "";
            if (id != null)
            {
                Candidat candidat = dbcand.Candidat.Find(id);
                candidat.voix = candidat.voix + 1;
                dbcand.Entry(candidat).State = EntityState.Modified;
                dbcand.SaveChanges();
                ViewBag.prenom = this.elect.prenom;
                return(RedirectToAction("index/"));
            }
            else
            {
                List <Candidat> cand = dbcand.Candidat.ToList <Candidat>();

                //ViewBag.candidats = new Candidat();
                //ViewBag.electeur = this.elect;

                return(View(dbcand.Candidat.ToList()));
            }
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "Id,prenom,nom,parti,datenaiss,photo,voix")] Candidat candidat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(candidat).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(candidat));
 }
 public ActionResult Edit([Bind(Include = "CountryId,CountryName")] Country country)
 {
     if (ModelState.IsValid)
     {
         db.Entry(country).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(PartialView(country));
 }
 public ActionResult Edit([Bind(Include = "PresidentId,PresidentName,Birthdate,BirthplaceId,Profession")] President president)
 {
     if (ModelState.IsValid)
     {
         db.Entry(president).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BirthplaceId = new SelectList(db.Provinces, "ProvinceId", "ProvinceName", president.BirthplaceId);
     return(View(president));
 }
Example #5
0
 public ActionResult Edit([Bind(Include = "DistrictId,DistrictName,ProvinceId")] District district)
 {
     if (ModelState.IsValid)
     {
         db.Entry(district).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProvinceId = new SelectList(db.Provinces, "ProvinceId", "ProvinceName", district.ProvinceId);
     return(PartialView(district));
 }
Example #6
0
 public ActionResult Edit([Bind(Include = "ProvinceId,ProvinceName,ElectionId")] Province province)
 {
     if (ModelState.IsValid)
     {
         db.Entry(province).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ElectionId = new SelectList(db.Elections, "ElectionId", "ElectionTitle", province.ElectionId);
     return(View(province));
 }
Example #7
0
 public ActionResult Edit([Bind(Include = "NeighbourhoodId,NeighbourhoodName,DistrictId")] Neighbourhood neighbourhood)
 {
     if (ModelState.IsValid)
     {
         db.Entry(neighbourhood).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DistrictId = new SelectList(db.Districts, "DistrictId", "DistrictName", neighbourhood.DistrictId);
     return(View(neighbourhood));
 }
Example #8
0
 public ActionResult Edit([Bind(Include = "ElectionId,ElectionTitle,ElectionDate,CountryId")] Election election)
 {
     if (ModelState.IsValid)
     {
         db.Entry(election).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", election.CountryId);
     return(View(election));
 }
 public ActionResult Edit([Bind(Include = "BallotBoxId,BallotBoxNumber,NeighbourhoodId,VoterCount")] BallotBox ballotBox)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ballotBox).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.NeighbourhoodId = new SelectList(db.Neighbourhoods, "NeighbourhoodId", "NeighbourhoodName", ballotBox.NeighbourhoodId);
     return(PartialView(ballotBox));
 }
 public ActionResult Edit([Bind(Include = "VoteId,BallotBoxId,PartyId,VoteCount")] Vote vote)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vote).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BallotBoxId = new SelectList(db.BallotBoxes, "BallotBoxId", "BallotBoxId", vote.BallotBoxId);
     ViewBag.PartyId     = new SelectList(db.Parties, "PartyId", "PartyName", vote.PartyId);
     return(PartialView(vote));
 }
 public ActionResult Edit([Bind(Include = "PartyId,PartyName,PresidentId,Founder,FoundationDate,HeadquartersId,IsParty")] Party party)
 {
     if (ModelState.IsValid)
     {
         db.Entry(party).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PresidentId    = new SelectList(db.Presidents, "PresidentId", "PresidentName", party.PresidentId);
     ViewBag.HeadquartersId = new SelectList(db.Provinces, "ProvinceId", "ProvinceName", party.HeadquartersId);
     return(PartialView(party));
 }