Ejemplo n.º 1
0
 //Get the details of a particular voter
 public VoterRoll GetVoterData(int voterId)
 {
     try
     {
         VoterRoll voter = db.VoterRoll.Find(voterId);
         return(voter);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 2
0
 //To Add new voter record
 public int AddVoter(VoterRoll voter)
 {
     try
     {
         db.VoterRoll.Add(voter);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 3
0
 //To Delete the record of a particular voter
 public int DeleteVoter(int voterId)
 {
     try
     {
         VoterRoll voter = db.VoterRoll.Find(voterId);
         db.VoterRoll.Remove(voter);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 4
0
        //To Update the records of a particluar voter
        public int UpdateVoter(VoterRoll voter)
        {
            try
            {
                db.Entry(voter).State = EntityState.Modified;
                db.SaveChanges();

                return(1);
            }
            catch
            {
                throw;
            }
        }