private async void AddEventStatusCommandExecuted() { var status = new EventStatus { ID = Guid.NewGuid(), Name = "New Event Status", Colour = "#808080", PreferredName = "" }; _adminDataUnit.EventStatusesRepository.Add(status); await _adminDataUnit.SaveChanges(); var statusModel = new EventStatusModel(status); LoadEventStatusOptions(statusModel); EventStatuses.Add(statusModel); SelectedObject = statusModel; }
private void LoadEventStatusOptions(EventStatusModel eventStatusModel) { eventStatusModel.Options = new ObservableCollection<EventOptionModel>(); var eventStatusOptions = eventStatusModel.EventStatus.EventStatusOptions.Select(x => x.EventOption); foreach (EventOption eventOption in EventOptions) { var eventOptionModel = new EventOptionModel(eventOption) { IsChecked = eventStatusOptions.Contains(eventOption) }; eventOptionModel.PropertyChanged += EventStatusOptionOnPropertyChanged; eventStatusModel.Options.Add(eventOptionModel); } }