public void UpdateElectorTable() { using (ElectionEntities Elections = new ElectionEntities()) { var ElectionFingerPrintData = Elections.FingerPrints.Where(s => s.UserID == NID.ToString()).FirstOrDefault(); if (ElectionFingerPrintData != null) { Elections.Electors.Add(new Elector { IdentificationNumber = txt_NationalID.ToString(), //PollingStationsId = 1, // IdentificationImg = txt_NationalID.ToString() + ".jpeg", // IdentificationTypeId = "", FingerPrintId = ElectionFingerPrintData.Serial, CreateDate = DateTime.Now }); Elections.SaveChanges(); } //else { // ElectionFingerPrintData.IdentificationNumber= // Elections.SaveChanges(); //} } }
public void UpdateElectorTable() { using (ElectionEntities Elections = new ElectionEntities()) { var ElectionFingerPrintData = Elections.FingerPrints.Where(s => s.UserID == txt_NationalID.Text).FirstOrDefault(); if (ElectionFingerPrintData != null) { Elections.Electors.Add(new Elector { IdentificationNumber = Cryptography.Encrypt(txt_NationalID.Text), PollingStationsId = int.Parse(ConfigurationManager.AppSettings["ElectionPollingStation"]), //IdentificationImg = txt_NationalID.Text + ".jpg", // IdentificationTypeId = "", FingerPrintId = ElectionFingerPrintData.Serial, CreateDate = DateTime.Now }); Elections.SaveChanges(); } } }