internal SurfSpot Create() { var surfSpot = new SurfSpot() { }; return(surfSpot); }
internal SurfSpot Save(SurfSpot surfSpot) { var surfSpots = Retrieve(); var maxId = surfSpots.Max(s => s.SpotId); surfSpot.SpotId = maxId + 1; surfSpots.Add(surfSpot); WriteData(surfSpots); return surfSpot; }
internal SurfSpot Save(SurfSpot surfSpot) { var surfSpots = Retrieve(); var maxId = surfSpots.Max(s => s.SpotId); surfSpot.SpotId = maxId + 1; surfSpots.Add(surfSpot); WriteData(surfSpots); return(surfSpot); }
internal SurfSpot Save(int id, SurfSpot surfSpot) { var surfSpots = Retrieve(); var itemIndex = surfSpots.FindIndex(s => s.SpotId == surfSpot.SpotId); if (itemIndex > 0) { surfSpots[itemIndex] = surfSpot; } else { return null; } WriteData(surfSpots); return surfSpot; }
internal SurfSpot Save(int id, SurfSpot surfSpot) { var surfSpots = Retrieve(); var itemIndex = surfSpots.FindIndex(s => s.SpotId == surfSpot.SpotId); if (itemIndex > 0) { surfSpots[itemIndex] = surfSpot; } else { return(null); } WriteData(surfSpots); return(surfSpot); }
internal SurfSpot Create() { var surfSpot = new SurfSpot() { }; return surfSpot; }