private void Commit(Visit visit) { lock (_CommitLocker) { var serializer = new JavaScriptSerializer(); using (var fs = new FileStream(VisitsFilePath, FileMode.Append, FileAccess.Write)) { using (TextWriter sw = new StreamWriter(fs)) { sw.WriteLine(serializer.Serialize(visit)); sw.Close(); } fs.Close(); } } }
public void AddVisit(Visit visit) { Visits.Add(visit); Commit(); }
public void AddVisit(Visit visit) { Commit(visit); }