/// <summary> /// this saves the dog to the list /// </summary> public void SaveDog() { DogModel dogModel = new DogModel(); dogModel.Name = DogName; dogModel.Breed = Breed; dogModel.Color = Color; dogModel.Gender = SelectedGender; if (Birthday != null) { dogModel.Birthday = Birthday.ToString("dd.MM.yyyy"); } if (PermanentCastrated) { dogModel.CastratedSince = CastratedSince.ToString("dd.MM.yyyy"); dogModel.PermanentCastrated = true; } else { dogModel.EffectiveUntil = EffectiveUntil.ToString("dd.MM.yyyy"); dogModel.PermanentCastrated = false; } if (DiseasesList.Count > 0) { dogModel.Diseases = new List <DiseasesModel>(DiseasesList); } if (CharacteristicsList.Count > 0) { dogModel.Characteristics = new List <CharacteristicsModel>(CharacteristicsList); } EventAggregationProvider.DogginatorAggregator.PublishOnUIThread(dogModel); }
/// <summary> /// this saves the dog to the list /// </summary> public void EditDog() { DogToEdit.Name = DogName; DogToEdit.Breed = Breed; DogToEdit.Color = Color; DogToEdit.Gender = SelectedGender; if (Birthday != null) { DogToEdit.Birthday = Birthday.ToString("dd.MM.yyyy"); } if (PermanentCastrated) { DogToEdit.CastratedSince = CastratedSince.ToString("dd.MM.yyyy"); DogToEdit.PermanentCastrated = true; } else { DogToEdit.EffectiveUntil = EffectiveUntil.ToString("dd.MM.yyyy"); DogToEdit.PermanentCastrated = false; } if (DiseasesList.Count > 0) { DogToEdit.Diseases = new List <DiseasesModel>(DiseasesList); } if (CharacteristicsList.Count > 0) { DogToEdit.Characteristics = new List <CharacteristicsModel>(CharacteristicsList); } if (NotActive) { DogToEdit.Active = 0; } else { DogToEdit.Active = 1; } IsDiseaseToSave = false; IsCharacteristicToSave = false; EventAggregationProvider.DogginatorAggregator.PublishOnUIThread(DogToEdit); TryClose(); }