protected override void Seed(evContext context) { // if (!WebSecurity.Initialized) // WebSecurity.InitializeDatabaseConnection("evotingDatabase", "UserProfile", "UserId", "UserName", autoCreateTables: true); // WebSecurity.InitializeDatabaseConnection("evotingDatabase", "UserProfile", "UserId", "UserName", autoCreateTables: true); if (!Roles.RoleExists("SuperAdmin")) { Roles.CreateRole("SuperAdmin"); } if (!Roles.RoleExists("Admin")) { Roles.CreateRole("Admin"); } if (!Roles.RoleExists("InterAdmin")) { Roles.CreateRole("InterAdmin"); } UnitOfWork work = new UnitOfWork(); //if (Membership.GetUser("chair") != null) //{ // Membership.DeleteUser("chair", true); // // Membership.CreateUser("chair", "P@ssw0rd"); // List<Voter> theVoter = work.VoterRepository.Get(a => a.FirstName == "chair").ToList(); // foreach (Voter v in theVoter) // { // // Voter theVoter = new Voter() { Department = "", FirstName = "chair", IdentityNumber = "chair", Voted = false, VotedTime = DateTime.Now, LoggedInAttemptsAfterVoting = 0, LastName = "", Password = "******" }; // work.VoterRepository.Delete(v); // } // work.Save(); //} if (Membership.GetUser("chair") == null) { Membership.CreateUser("chair", "scandalla"); Voter theVoter = new Voter() { Department = "", FirstName = "chair", IdentityNumber = "chair", Voted = false, VotedTime = DateTime.Now, LoggedInAttemptsAfterVoting = 0, LastName = "", Password = "******" }; work.VoterRepository.Insert(theVoter); work.Save(); } // Roles.AddUserToRole("kayode", "SuperAdmin"); //if (!WebSecurity.UserExists("chair")) // WebSecurity.CreateUserAndAccount( // "chair", // "P@ssw0rd"); //if (Membership.GetUser("kazeem") != null) //{ // Membership.DeleteUser("kazeem", true); // // Membership.CreateUser("chair", "P@ssw0rd"); // // Voter theVoter = work.VoterRepository.Get(a => a.FirstName == "kazeem").First(); // // Voter theVoter = new Voter() { Department = "", FirstName = "chair", IdentityNumber = "chair", Voted = false, VotedTime = DateTime.Now, LoggedInAttemptsAfterVoting = 0, LastName = "", Password = "******" }; // List<Voter> theVoter = work.VoterRepository.Get(a => a.FirstName == "kazeem").ToList(); // foreach (Voter v in theVoter) // { // // Voter theVoter = new Voter() { Department = "", FirstName = "chair", IdentityNumber = "chair", Voted = false, VotedTime = DateTime.Now, LoggedInAttemptsAfterVoting = 0, LastName = "", Password = "******" }; // work.VoterRepository.Delete(v); // } // work.Save(); // // work.VoterRepository.Insert(theVoter); // // work.Save(); //} if (Membership.GetUser("kazeem") == null) { // UnitOfWork work = new UnitOfWork(); Membership.CreateUser("kazeem", "kazeemA1"); Voter theVoter = new Voter() { Department = "", FirstName = "kazeem", IdentityNumber = "kazeem", Voted = false, VotedTime = DateTime.Now, LoggedInAttemptsAfterVoting = 0, LastName = "Oyebode1234567", Password = "******" }; work.VoterRepository.Insert(theVoter); work.Save(); } if (Membership.GetUser("password") == null) { // UnitOfWork work = new UnitOfWork(); Membership.CreateUser("password", "P@ssw0rd"); Voter theVoter = new Voter() { Department = "", FirstName = "password", IdentityNumber = "password", Voted = false, VotedTime = DateTime.Now, LoggedInAttemptsAfterVoting = 0, LastName = "", Password = "******" }; work.VoterRepository.Insert(theVoter); work.Save(); } if (!Roles.GetRolesForUser("kazeem").Contains("SuperAdmin")) { Roles.AddUsersToRoles(new[] { "kazeem" }, new[] { "SuperAdmin" }); } if (!Roles.GetRolesForUser("chair").Contains("InterAdmin")) { Roles.AddUsersToRoles(new[] { "chair" }, new[] { "InterAdmin" }); } if (!Roles.GetRolesForUser("password").Contains("Admin")) { Roles.AddUsersToRoles(new[] { "password" }, new[] { "Admin" }); } // UnitOfWork work = new UnitOfWork(); //List<Voter> akin = work.VoterRepository.Get(a => a.IdentityNumber == "chair").ToList(); //if (akin.Count() == 0) //{ //} //List<Voter> pass = work.VoterRepository.Get(a => a.IdentityNumber == "password").ToList(); //if (pass.Count() == 0) //{ //} //List<Voter> kazee = work.VoterRepository.Get(a => a.IdentityNumber == "kazeem").ToList(); //if (kazee.Count() == 0) //{ //} // } }
public ElectorateRepository(evContext context) : base(context) { }
public ParticipantRepository(evContext context) : base(context) { }
public ActionResult Voted(string PRESIDENT, string VICE_PRESIDENT, string GENERAL_SECRETARY, string ASST_GENERAL_SECRETARY, string FINANCIAL_SECRETARY, string TREASURER, string PUBLIC_RELATIONS_OFFICER, string SOCIAL_DIRECTOR, string WELFARE_OFFICER, string SPORT_DIRECTOR, string ASST_SPORT_DIRECTOR, string theKey) { long theCounter = Convert.ToInt64(theKey); if (theCounter > 0) { // var future = new Date("Dec 3 2013 21:15:00 GMT+0200"); // var now = new Date(); // var difference = Math.floor((future.getTime() - now.getTime()) / 1000); //@Html.Raw(theParticipants[0].ParticipantID + ":" + "YES") //PRESIDENT // VICE_PRESIDENT //GENERAL_SECRETARY //ASSISTANT_GENERAL_SECRETARY //FINANCIAL_SECRETARY //TREASURER //PUBLIC_RELATIONS_OFFICER var context = new evContext(); // using (var context = new evContext()) // { // context. //president int pre = 0; if (!(string.IsNullOrEmpty(PRESIDENT))) { string[] c = PRESIDENT.Split(':'); if (c.Count() == 1) { pre = Convert.ToInt32(PRESIDENT); // Participant thePar = work.ParticipantRepository.GetByID(pre); Participant thePar = context.Participants.Find(pre); thePar.Vote = thePar.Vote + 1; } if (c.Count() == 2) { //@Html.Raw(theParticipants[0].ParticipantID + ":" + "YES") pre = Convert.ToInt32(c[0]); // Participant thePar = work.ParticipantRepository.GetByID(pre); Participant thePar = context.Participants.Find(pre); if (c[1] == "YES") { thePar.Yes = thePar.Yes + 1; } if (c[1] == "NO") { thePar.No = thePar.No + 1; } } // context.Participants.sa // work.ParticipantRepository.Update(thePar); // work.Save(); } //vp int vp = 0; if (!(string.IsNullOrEmpty(VICE_PRESIDENT))) { string[] c = VICE_PRESIDENT.Split(':'); if (c.Count() == 1) { vp = Convert.ToInt32(VICE_PRESIDENT); Participant vpPar = context.Participants.Find(vp); vpPar.Vote = vpPar.Vote + 1; } if (c.Count() == 2) { vp = Convert.ToInt32(c[0]); Participant vpPar = context.Participants.Find(vp); if (c[1] == "YES") { vpPar.Yes = vpPar.Yes + 1; } if (c[1] == "NO") { vpPar.No = vpPar.No + 1; } } // work.ParticipantRepository.Update(vpPar); // work.Save(); } //gs int gn = 0; if (!(string.IsNullOrEmpty(GENERAL_SECRETARY))) { string[] c = GENERAL_SECRETARY.Split(':'); if (c.Count() == 1) { gn = Convert.ToInt32(GENERAL_SECRETARY); Participant vpPar = context.Participants.Find(gn); vpPar.Vote = vpPar.Vote + 1; } if (c.Count() == 2) { gn = Convert.ToInt32(c[0]); Participant vpPar = context.Participants.Find(gn); if (c[1] == "YES") { vpPar.Yes = vpPar.Yes + 1; } if (c[1] == "NO") { vpPar.No = vpPar.No + 1; } } // work.ParticipantRepository.Update(vpPar); // work.Save(); } //ags int ags = 0; if (!(string.IsNullOrEmpty(ASST_GENERAL_SECRETARY))) { string[] c = ASST_GENERAL_SECRETARY.Split(':'); if (c.Count() == 1) { ags = Convert.ToInt32(ASST_GENERAL_SECRETARY); Participant Par = context.Participants.Find(ags); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { ags = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(ags); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //pro int pro = 0; if (!(string.IsNullOrEmpty(PUBLIC_RELATIONS_OFFICER))) { string[] c = PUBLIC_RELATIONS_OFFICER.Split(':'); if (c.Count() == 1) { pro = Convert.ToInt32(PUBLIC_RELATIONS_OFFICER); Participant Par = context.Participants.Find(pro); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { pro = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(pro); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //fs int fs = 0; if (!(string.IsNullOrEmpty(FINANCIAL_SECRETARY))) { string[] c = FINANCIAL_SECRETARY.Split(':'); if (c.Count() == 1) { fs = Convert.ToInt32(FINANCIAL_SECRETARY); Participant Par = context.Participants.Find(fs); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { fs = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(fs); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //tr int tr = 0; if (!(string.IsNullOrEmpty(TREASURER))) { string[] c = TREASURER.Split(':'); if (c.Count() == 1) { tr = Convert.ToInt32(TREASURER); Participant Par = context.Participants.Find(tr); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { tr = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(tr); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //sd int sd = 0; if (!(string.IsNullOrEmpty(SOCIAL_DIRECTOR))) { string[] c = SOCIAL_DIRECTOR.Split(':'); if (c.Count() == 1) { sd = Convert.ToInt32(SOCIAL_DIRECTOR); Participant Par = context.Participants.Find(sd); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { sd = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(sd); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //wo int wo = 0; if (!(string.IsNullOrEmpty(WELFARE_OFFICER))) { string[] c = WELFARE_OFFICER.Split(':'); if (c.Count() == 1) { wo = Convert.ToInt32(WELFARE_OFFICER); Participant Par = context.Participants.Find(wo); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { wo = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(wo); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //sdr int sdr = 0; if (!(string.IsNullOrEmpty(SPORT_DIRECTOR))) { string[] c = SPORT_DIRECTOR.Split(':'); if (c.Count() == 1) { sdr = Convert.ToInt32(SPORT_DIRECTOR); Participant Par = context.Participants.Find(sdr); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { sdr = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(sdr); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //wo int asd = 0; if (!(string.IsNullOrEmpty(ASST_SPORT_DIRECTOR))) { string[] c = ASST_SPORT_DIRECTOR.Split(':'); if (c.Count() == 1) { asd = Convert.ToInt32(ASST_SPORT_DIRECTOR); Participant Par = context.Participants.Find(asd); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { asd = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(asd); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //ds //int ds = 0; //if (!(string.IsNullOrEmpty(DIRECTOR_OF_SPORT))) //{ // ds = Convert.ToInt32(DIRECTOR_OF_SPORT); // Participant Par = context.Participants.Find(ds); // Par.Vote = Par.Vote + 1; // // work.ParticipantRepository.Update(Par); // //work.Save(); //} //dos //int pro = 0; //if (!(string.IsNullOrEmpty(PUBLIC_RELATIONS_OFFICER))) //{ // pro = Convert.ToInt32(PUBLIC_RELATIONS_OFFICER); // Participant Par = context.Participants.Find(pro); // Par.Vote = Par.Vote + 1; // // work.ParticipantRepository.Update(Par); // // work.Save(); //} //dos //int wo = 0; //if (!(string.IsNullOrEmpty(WELFARE_OFFICER))) //{ // wo = Convert.ToInt32(WELFARE_OFFICER); // Participant Par = context.Participants.Find(wo); // Par.Vote = Par.Vote + 1; // // work.ParticipantRepository.Update(Par); // // work.Save(); //} ////l //int l = 0; //if (!(string.IsNullOrEmpty(LIBRARIAN))) //{ // l = Convert.ToInt32(LIBRARIAN); // Participant Par = context.Participants.Find(l); // Par.Vote = Par.Vote + 1; // // work.ParticipantRepository.Update(Par); // // work.Save(); //} bool saveFailed; do { saveFailed = false; try { string theUserNamee = User.Identity.Name; Voter theVoter = work.VoterRepository.Get(a => a.IdentityNumber == theUserNamee).First(); // theVoter.VotedTime = DateTime.Now; // theVoter.Voted = true; if (theVoter.Voted != true) { context.SaveChanges(); context.Dispose(); } } catch (DbUpdateConcurrencyException ex) { saveFailed = true; // Update the values of the entity that failed to save from the store // ex.Entries.Single().Reload(); //ex.Data. context = new evContext(); //president pre = 0; if (!(string.IsNullOrEmpty(PRESIDENT))) { string[] c = PRESIDENT.Split(':'); if (c.Count() == 1) { pre = Convert.ToInt32(PRESIDENT); // Participant thePar = work.ParticipantRepository.GetByID(pre); Participant thePar = context.Participants.Find(pre); thePar.Vote = thePar.Vote + 1; } if (c.Count() == 2) { //@Html.Raw(theParticipants[0].ParticipantID + ":" + "YES") pre = Convert.ToInt32(c[0]); // Participant thePar = work.ParticipantRepository.GetByID(pre); Participant thePar = context.Participants.Find(pre); if (c[1] == "YES") { thePar.Yes = thePar.Yes + 1; } if (c[1] == "NO") { thePar.No = thePar.No + 1; } } //pre = Convert.ToInt32(PRESIDENT); //// Participant thePar = work.ParticipantRepository.GetByID(pre); //Participant thePar = context.Participants.Find(pre); //thePar.Vote = thePar.Vote + 1; //// context.Participants.sa //// work.ParticipantRepository.Update(thePar); //// work.Save(); } //vp vp = 0; if (!(string.IsNullOrEmpty(VICE_PRESIDENT))) { string[] c = VICE_PRESIDENT.Split(':'); if (c.Count() == 1) { vp = Convert.ToInt32(VICE_PRESIDENT); Participant vpPar = context.Participants.Find(vp); vpPar.Vote = vpPar.Vote + 1; } if (c.Count() == 2) { vp = Convert.ToInt32(c[0]); Participant vpPar = context.Participants.Find(vp); if (c[1] == "YES") { vpPar.Yes = vpPar.Yes + 1; } if (c[1] == "NO") { vpPar.No = vpPar.No + 1; } } //vp = Convert.ToInt32(VICE_PRESIDENT); //Participant vpPar = context.Participants.Find(vp); //vpPar.Vote = vpPar.Vote + 1; //// work.ParticipantRepository.Update(vpPar); //// work.Save(); } //gs gn = 0; if (!(string.IsNullOrEmpty(GENERAL_SECRETARY))) { string[] c = GENERAL_SECRETARY.Split(':'); if (c.Count() == 1) { gn = Convert.ToInt32(GENERAL_SECRETARY); Participant vpPar = context.Participants.Find(gn); vpPar.Vote = vpPar.Vote + 1; } if (c.Count() == 2) { gn = Convert.ToInt32(c[0]); Participant vpPar = context.Participants.Find(gn); if (c[1] == "YES") { vpPar.Yes = vpPar.Yes + 1; } if (c[1] == "NO") { vpPar.No = vpPar.No + 1; } } //gn = Convert.ToInt32(GENERAL_SECRETARY); //Participant vpPar = context.Participants.Find(gn); //vpPar.Vote = vpPar.Vote + 1; //// work.ParticipantRepository.Update(vpPar); //// work.Save(); } //ags ags = 0; if (!(string.IsNullOrEmpty(ASST_GENERAL_SECRETARY))) { string[] c = ASST_GENERAL_SECRETARY.Split(':'); if (c.Count() == 1) { ags = Convert.ToInt32(ASST_GENERAL_SECRETARY); Participant Par = context.Participants.Find(ags); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { ags = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(ags); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } //ags = Convert.ToInt32(ASSISTANT_GENERAL_SECRETARY); //Participant Par = context.Participants.Find(ags); //Par.Vote = Par.Vote + 1; //// work.ParticipantRepository.Update(Par); //// work.Save(); } //pro pro = 0; if (!(string.IsNullOrEmpty(PUBLIC_RELATIONS_OFFICER))) { string[] c = PUBLIC_RELATIONS_OFFICER.Split(':'); if (c.Count() == 1) { pro = Convert.ToInt32(PUBLIC_RELATIONS_OFFICER); Participant Par = context.Participants.Find(pro); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { pro = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(pro); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } //pro = Convert.ToInt32(PUBLIC_RELATION_OFFICER); //Participant Par = context.Participants.Find(pro); //Par.Vote = Par.Vote + 1; //// work.ParticipantRepository.Update(Par); //// work.Save(); } //fs fs = 0; if (!(string.IsNullOrEmpty(FINANCIAL_SECRETARY))) { string[] c = FINANCIAL_SECRETARY.Split(':'); if (c.Count() == 1) { fs = Convert.ToInt32(FINANCIAL_SECRETARY); Participant Par = context.Participants.Find(fs); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { fs = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(fs); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } //fs = Convert.ToInt32(FINANCIAL_SECRETARY); //Participant Par = context.Participants.Find(fs); //Par.Vote = Par.Vote + 1; //// work.ParticipantRepository.Update(Par); //// work.Save(); } //tr tr = 0; if (!(string.IsNullOrEmpty(TREASURER))) { string[] c = TREASURER.Split(':'); if (c.Count() == 1) { tr = Convert.ToInt32(TREASURER); Participant Par = context.Participants.Find(tr); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { tr = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(tr); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } //tr = Convert.ToInt32(TREASURER); //Participant Par = context.Participants.Find(tr); //Par.Vote = Par.Vote + 1; //// work.ParticipantRepository.Update(Par); //// work.Save(); } sd = 0; if (!(string.IsNullOrEmpty(SOCIAL_DIRECTOR))) { string[] c = SOCIAL_DIRECTOR.Split(':'); if (c.Count() == 1) { sd = Convert.ToInt32(SOCIAL_DIRECTOR); Participant Par = context.Participants.Find(sd); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { sd = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(sd); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //wo wo = 0; if (!(string.IsNullOrEmpty(WELFARE_OFFICER))) { string[] c = WELFARE_OFFICER.Split(':'); if (c.Count() == 1) { wo = Convert.ToInt32(WELFARE_OFFICER); Participant Par = context.Participants.Find(wo); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { wo = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(wo); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //sdr sdr = 0; if (!(string.IsNullOrEmpty(SPORT_DIRECTOR))) { string[] c = SPORT_DIRECTOR.Split(':'); if (c.Count() == 1) { sdr = Convert.ToInt32(SPORT_DIRECTOR); Participant Par = context.Participants.Find(sdr); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { sdr = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(sdr); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //wo asd = 0; if (!(string.IsNullOrEmpty(ASST_SPORT_DIRECTOR))) { string[] c = ASST_SPORT_DIRECTOR.Split(':'); if (c.Count() == 1) { asd = Convert.ToInt32(ASST_SPORT_DIRECTOR); Participant Par = context.Participants.Find(asd); Par.Vote = Par.Vote + 1; } if (c.Count() == 2) { asd = Convert.ToInt32(c[0]); Participant Par = context.Participants.Find(asd); if (c[1] == "YES") { Par.Yes = Par.Yes + 1; } if (c[1] == "NO") { Par.No = Par.No + 1; } } // work.ParticipantRepository.Update(Par); // work.Save(); } //ds //pro = 0; //if (!(string.IsNullOrEmpty(PUBLIC_RELATIONS_OFFICER))) //{ // pro = Convert.ToInt32(PUBLIC_RELATIONS_OFFICER); // Participant Par = context.Participants.Find(pro); // Par.Vote = Par.Vote + 1; // // work.ParticipantRepository.Update(Par); // //work.Save(); //} //dos //dos = 0; //if (!(string.IsNullOrEmpty(DIRECTOR_OF_SOCIAL))) //{ // dos = Convert.ToInt32(DIRECTOR_OF_SOCIAL); // Participant Par = context.Participants.Find(dos); // Par.Vote = Par.Vote + 1; // // work.ParticipantRepository.Update(Par); // // work.Save(); //} ////dos //wo = 0; //if (!(string.IsNullOrEmpty(WELFARE_OFFICER))) //{ // wo = Convert.ToInt32(WELFARE_OFFICER); // Participant Par = context.Participants.Find(wo); // Par.Vote = Par.Vote + 1; // // work.ParticipantRepository.Update(Par); // // work.Save(); //} ////l //l = 0; //if (!(string.IsNullOrEmpty(LIBRARIAN))) //{ // l = Convert.ToInt32(LIBRARIAN); // Participant Par = context.Participants.Find(l); // Par.Vote = Par.Vote + 1; // // work.ParticipantRepository.Update(Par); // // work.Save(); //} } } while (saveFailed); // } string theUserName = User.Identity.Name; if (!(theUserName.EndsWith("eem"))) { //if(theUserNamee.) Voter theVoter = work.VoterRepository.Get(a => a.IdentityNumber == theUserName).First(); if (theVoter.Voted != true) { theVoter.VotedTime = DateTime.Now; theVoter.Voted = true; work.VoterRepository.Update(theVoter); work.Save(); } } //,string ,string ,string ,string ) // MvcMembership.log FormsAuthentication.SignOut(); // WebSecurity.Logout();///Account/Login return RedirectToAction("Login", "Account", new { id = 1 }); // return View(); } else { FormsAuthentication.SignOut(); // WebSecurity.Logout();///Account/Login return RedirectToAction("Login", "Account", new { id = 2 }); } }
public PhotoRepository(evContext context) : base(context) { }
public PostRepository(evContext context) : base(context) { }
public VoterRepository(evContext context) : base(context) { }
//public GenericRepository() //{ // SchoolContext context = new SchoolContext(); // this.context = context; // this.dbSet = context.Set<TEntity>(); //} public GenericRepository(evContext context) { this.context = context; this.dbSet = context.Set <TEntity>(); }