private async Task AddStyle() { var style = new StyleModel(Title, MotherCountry, Era); await _stylesManager.AddStyle(style); _customNavigationService.NavigateTo(PageKeys.StyleMain); }
private void SetupFields() { StyleModel editableStyle = _style; Title = editableStyle?.Title ?? string.Empty; MotherCountry = editableStyle?.MotherCountry ?? string.Empty; Era = editableStyle?.Era ?? string.Empty; }
public StyleAddViewModel(IStylesManager stylesManager) { _stylesManager = stylesManager; _customNavigationService = ServiceLocator.Current.GetInstance <ICustomNavigationService>("StyleInternal"); _style = _customNavigationService.CurrentPageParams as StyleModel; SaveCommand = _style == null ? new RelayCommand(async() => await AddStyle()) : new RelayCommand(async() => await UpdateStyle()); ActionText = _style == null ? "Добавление" : "Редактирование"; ButtonText = _style == null ? "Добавить" : "Сохранить изменения"; SetupFields(); }
public void EditStyle(StyleModel itemToEdit) { _customNavigationService.NavigateTo(PageKeys.StyleAdd, itemToEdit); }