// Data to model. public static BusinessModel Map( Business data ) { BusinessModel model = null; if (data != null) { model = new BusinessModel { Address = data.Address, Category = data.Category, City = data.City, Id = data.Id, Latitude = data.Latitude, Longitude = data.Longitude, Name = data.Name, PhoneNumber = data.PhoneNumber, State = data.State, }; } return model; }
private Business MapVenueItemToBusiness(FourSquareItem venueItem) { var business = new Business(); business.Id = venueItem.Id; business.Name = venueItem.Name; business.Url = venueItem.Url; if (venueItem.Contact != null) { business.PhoneNumber = venueItem.Contact.Phone; business.FormattedPhoneNumber = venueItem.Contact.FormattedPhone; } if (venueItem.Categories != null && venueItem.Categories.Any()) { business.Category = venueItem.Categories.First().Name; } if (venueItem.Location != null) { business.Latitude = venueItem.Location.Lat; business.Longitude = venueItem.Location.Lng; business.Distance = venueItem.Location.Distance; business.Address = venueItem.Location.Address; business.City = venueItem.Location.City; business.State = venueItem.Location.State; } return business; }