public int Save(Location location) { ILocationDbProvider db = ObjectContainer.GetLocationDbProvider(); if (location.ID == 0) { int id = db.Create(location); return(id); } else { return(db.Update(location)); } }
public List <Location> EraseListLocationPoints(List <Location> locations) { ILocationDbProvider locationDbProvider = ObjectContainer.GetLocationDbProvider(); for (var i = 0; i < locations.Count; i++) { if (locations[i].Transit) { locationDbProvider.Delete(locations[i].ID); locations.RemoveAt(i); locationDbProvider.Delete(locations[i - 1].ID); locations.RemoveAt(i - 1); i -= 2; //Order is important here } } return(locations); }
public Location Get(int id) { ILocationDbProvider db = ObjectContainer.GetLocationDbProvider(); return(db.Read(id)); }