コード例 #1
0
 private async void SaveFunc()
 {
     if (!UrlText.Equals("") && !NameText.Equals("") && !DescriptionText.Equals(""))
     {
         using (var db = new PrototypingContext())
         {
             Prototype findPrototype = db.Prototypes.Single(p => p.PrototypeId == prototype.PrototypeId);
             findPrototype.Url         = UrlText;
             findPrototype.Name        = NameText;
             findPrototype.Description = DescriptionText;
             db.Prototypes.Update(findPrototype);
             db.SaveChanges();
         }
         GoBackFunc();
     }
     else
     {
         var message = new MessageDialog("Please fill in all the fields.");
         await message.ShowAsync();
     }
 }
コード例 #2
0
 private async void CreateFunc()
 {
     if (!UrlText.Equals("") && !NameText.Equals("") && !DescriptionText.Equals(""))
     {
         using (var db = new PrototypingContext())
         {
             db.Prototypes.Add(new Prototype()
             {
                 Name        = NameText,
                 Url         = UrlText,
                 Description = DescriptionText,
                 CreatedDate = DateTime.Now
             });
             db.SaveChanges();
         }
         GoBackFunc();
     }
     else
     {
         var message = new MessageDialog("Please fill in all the fields.");
         await message.ShowAsync();
     }
 }