public IEnumerable <MetroWebModel> Get(string country) { Country countryObj = Country.Get(country); var metros = new MetrosLogic(db).GetMetrosInCountry(countryObj); return(metros); }
void parseCountryAndMetro(string country, string metro, out Country countryObj, out MetroWebModel metroObj) { // country countryObj = Country.Get(country); if (countryObj == null) { throw new Exception("Unknown country - " + country); } // metro metroObj = null; if (string.IsNullOrEmpty(metro) == false && metro.ToLower() != "all") { metroObj = new MetrosLogic(db).Get(countryObj.ThreeLetterCode, metro); if (metroObj == null) { throw new Exception("Unknown metro - " + metro); } } }
public int Post([FromBody] VenueWebModel venue) { var athlete = new UserProfileLogic(db).GetAthleteForUserName(User.Identity.Name); var metros = new MetrosLogic(db).GetMetrosAround(venue.Location); if (metros.Count == 0) { throw new Exception("No metros around this location: " + venue.Location.ToString()); } var metro = metros[0]; venue.MetroID = metro.ID; venue.Country = metro.Country; Venue venueToCreate = venue.ToVenue(); Venue createdVenue = new VenuesLogic(db).RegisterVenue(venueToCreate, athlete.AthleteID); return(createdVenue.VenueID); }
public IEnumerable <MetroWebModel> Closest(double latitude, double longitude) { var metros = new MetrosLogic(db).GetMetrosAround(new Location(latitude, longitude)); return(metros); }
public MetroWebModel Get(int id) { var metro = new MetrosLogic(db).Get(id); return(metro); }