//Get the details of a particular voter public VoterRoll GetVoterData(int voterId) { try { VoterRoll voter = db.VoterRoll.Find(voterId); return(voter); } catch { throw; } }
//To Add new voter record public int AddVoter(VoterRoll voter) { try { db.VoterRoll.Add(voter); db.SaveChanges(); return(1); } catch { throw; } }
//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; } }
//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; } }