public bool DeleteAward(Award award) { if (Awards.Any(n => n.Id != award.Id)) { return(false); } Awards.Remove(award); StreamReader reader = new StreamReader(entitiesInformationFile); StreamWriter writer = new StreamWriter(entitiesInformationFile); string line = null; while ((line = reader.ReadLine()) != null) { if (String.Compare(line, award.ToString()) == 0) { continue; } writer.WriteLine(line); } reader.Close(); writer.Close(); return(true); }
public bool AddAward(Award award) { if (Awards.Any(n => n.Id == award.Id)) { return(false); } Awards.Add(award); StreamWriter writer = new StreamWriter(entitiesInformationFile); writer.WriteLine(award.ToString()); writer.Close(); return(true); }