private void GetValidFields(ItemResult r) { if (IDSpinner.Enabled && IDSpinner.Value > 0 && !IDSpinner.Controls[1].Text.Equals(string.Empty)) { r.IDValue = IDSpinner.Value; } if (OwnerCombo.Enabled && OwnerCombo.SelectedIndex >= 0) { r.OwnerValue = OwnerCombo.SelectedItem.ToString(); } if (TypeCombo.Enabled && TypeCombo.SelectedIndex >= 0) { r.TypeValue = TypeCombo.SelectedItem.ToString(); } if (SerialText.Enabled && !SerialText.Text.Equals(string.Empty)) { r.SerialValue = SerialText.Text; } if (PlatformCombo.Enabled && PlatformCombo.SelectedIndex >= 0) { r.PlatformValue = PlatformCombo.SelectedItem.ToString(); } if (DescriptionText.Enabled && !DescriptionText.Equals(string.Empty)) { r.DescriptionValue = DescriptionText.Text; } }
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(); } }
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(); } }