internal City ConvertDalCityToObjCity(FavoritesCity dalCity) { return(new City() { Key = dalCity.CityKey, LocalizedName = dalCity.Name, }); }
private WeatherDetails ConvertDalCityToWeatherDetails(FavoritesCity city) { WeatherDetails wd = new WeatherDetails(); wd.Temperature = new Temperature(); wd.Temperature.Metric = new TempratureDetails(); wd.Temperature.Metric.Value = (double)city.CelsiusTemprature; wd.WeatherText = city.WeatherText; return(wd); }
internal void AddToFavorites(City cityData) { using (var ctx = new MyFavoritesWeatherEntities()) { if (!ctx.FavoritesCities.Where(x => x.CityKey == cityData.Key).Any()) { var item = new FavoritesCity() { CityKey = cityData.Key, Name = cityData.LocalizedName, Status = (int)Enums.FavoriteStatus.Active }; ctx.FavoritesCities.Add(item); ctx.SaveChanges(); } }; }