// pull plant from the database public void fetchPlantDetails(int plantId) { try { var myPlant = myPlantManager.GetPlant(plantId); oldPlant = myPlant; this.plantId.Text = myPlant.PlantID.ToString(); this.name.Text = myPlant.Name; this.type.Text = myPlant.Type; this.category.Text = myPlant.Category; this.season.Text = myPlant.Season; this.description.Text = myPlant.Description; } catch (Exception ax) { MessageBox.Show(ax.Message); } }
public VarietyEditViewModel() { _plantManager = new PlantManager(); _noteManager = new NoteManager(); MessagingCenter.Subscribe <PlantEditViewModel, Plant>(this, "Plant", (message, args) => { _selectedPlant = args; PlantName = _selectedPlant.Name; }); MessagingCenter.Subscribe <PlantEditViewModel, Variety>(this, "EditVariety", async(message, args) => { _selectedVariety = args; Name = _selectedVariety.Name; _selectedPlant = await _plantManager.GetPlant(_selectedVariety.PlantId); PlantName = _selectedPlant.Name; var notesResult = await _noteManager.GetNote((int)NoteType.Variety, _selectedVariety.ID); Notes = notesResult == null ? string.Empty : notesResult.Notes; }); }