public void SaveMessage(Message message) { using (EntityConnection connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Messages.AddObject(message); _core.SaveChanges(); } }
public Event SaveNewEvent(Event comp) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Events.AddObject(comp); _core.SaveChanges(); } return comp; }
public Series SaveNewSeries(Series series) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Series.AddObject(series); _core.SaveChanges(); } return series; }
public Location SaveNewLocation(Location location) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Locations.AddObject(location); _core.SaveChanges(); } return location; }
public void DeleteResult(Result result) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); string query = string.Format("delete from Result where ResultId = {0}", result.ResultId); _core.ExecuteStoreCommand(query); _core.SaveChanges(); } }
public Event UpdateEvent(Event comp) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Events.Attach(_core.Events.Single(s => s.EventId == comp.EventId)); _core.Events.ApplyCurrentValues(comp); _core.SaveChanges(); } return comp; }
public Location UpdateLocation(Location location) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Locations.Attach(_core.Locations.Single(l => l.LocationId == location.LocationId)); _core.Locations.ApplyCurrentValues(location); _core.SaveChanges(); } return location; }
public void UpdateScores(IList<Score> scores) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); foreach (var score in scores) { _core.Scores.Attach(_core.Scores.Single(s => s.ScoreId == score.ScoreId)); _core.Scores.ApplyCurrentValues(score); _core.SaveChanges(); } } }
public void DeleteScores(EntityCollection<Score> scores) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); foreach (var score in scores) { string query = string.Format("delete from Score where ScoreId = {0}", score.ScoreId); _core.ExecuteStoreCommand(query); } _core.SaveChanges(); } }
public Driver UpdateDriver(Driver driver) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Drivers.Attach(_core.Drivers.Single(c => c.DriverId == driver.DriverId)); _core.Drivers.ApplyCurrentValues(driver); _core.SaveChanges(); } return driver; }
public Driver SaveNewDriver(Driver driver) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Drivers.AddObject(driver); _core.SaveChanges(); } return driver; }
public IList<Result> UpdateResultSet(IList<Result> results) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); foreach(var result in results) { _core.Results.Attach(_core.Results.Single(r => r.ResultId == result.ResultId)); _core.Results.ApplyCurrentValues(result); _core.SaveChanges(); } } return results; }
public void SaveNewScores(Result result) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Results.AddObject(result); _core.SaveChanges(); } }
public Club UpdateClub(Club club) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Clubs.Attach(_core.Clubs.Single(c => c.ClubId == club.ClubId)); _core.Clubs.ApplyCurrentValues(club); _core.SaveChanges(); } return club; }
public Club SaveNewClub(Club club) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Clubs.AddObject(club); _core.SaveChanges(); } return club; }
public Series UpdateSeries(Series series, IList<SeriesClass> newClasses) { using (var connection = new EntityConnection("name=CoreContainer")) { _core = new CoreContainer(connection); _core.Series.Attach(_core.Series.Include("SeriesClasses").Single(s => s.SeriesId == series.SeriesId)); _core.Series.ApplyCurrentValues(series); if (series.SeriesClasses != null && series.SeriesClasses.Count > 0) { foreach (var oldClass in series.SeriesClasses) { string query = string.Format("delete from SeriesClass where SeriesClassId = {0}", oldClass.SeriesClassId); _core.ExecuteStoreCommand(query); } } var saveSeries = _core.Series.Single(s => s.SeriesId == series.SeriesId); foreach (var selectedClass in newClasses) { saveSeries.SeriesClasses.Add(new SeriesClass{ClassId = selectedClass.ClassId, SeriesId = selectedClass.SeriesId}); } _core.SaveChanges(); } return series; }