コード例 #1
0
 private void Pin()
 {
     try
     {
         using (var db = new ForecastContext())
         {
             db.Database.EnsureCreated();
             var item = new ForecastDbitem
             {
                 Place     = Place,
                 Degrees   = Degrees,
                 Condition = Condition,
                 ImageUrl  = ImageUrl
             };
             db.Add(item);
             db.SaveChanges();
             db.Entry(item).GetDatabaseValues();
             _dbId = item.ForecastDbitemId;
         }
         Pinned = true;
     }
     catch (Exception exception)
     {
         new MessageDialog(exception.Message).ShowAsync();
     }
 }
コード例 #2
0
 /// <summary>
 /// For database pulling
 /// </summary>
 /// <param name="forecastService"></param>
 /// <param name="item">dbSet item</param>
 public ForecastItem(ForecastService forecastService, ForecastDbitem item)
 {
     _error           = true;
     _forecastService = forecastService;
     Pinned           = true;
     _dbId            = item.ForecastDbitemId;
     Place            = item.Place;
     Degrees          = item.Degrees;
     Condition        = item.Condition;
     ImageUrl         = item.ImageUrl;
 }