public void DeleteValueToType(long voterCode, long typeDetailsId, bool checked1) { ValueToType valueToTypes = DB.ValueToTypes.Where(v => v.VoterCode == voterCode && v.TypeDetailsId == typeDetailsId).ToList()[0]; valueToTypes.DeleteRow = !checked1; DB.Entry(valueToTypes).State = EntityState.Modified; DB.SaveChanges(); }
public List <long> EmptyValueToTypeAndGetTypeDetailsCodes(List <long> voterCodes) { List <long> typeDetailsCodes = new List <long>(); for (int i = 0; i < voterCodes.Count; i++) { long voterCode = voterCodes[i]; List <ValueToType> valuesToType = DB.ValueToTypes.Where(code => code.VoterCode == voterCode).ToList(); for (int j = 0; j < valuesToType.Count; j++) { ValueToType valueToType = valuesToType[j]; typeDetailsCodes.Add(valueToType.TypeDetailsId); DB.ValueToTypes.Remove(valueToType); DB.SaveChanges(); } } return(typeDetailsCodes); }
public void AddValueToType(ValueToType newValueToType) { DB.ValueToTypes.Add(newValueToType); DB.SaveChanges(); }