public void OpenProfileConfigure(AddOrEdit addOrEdit) { NavigationParameters parameters = new NavigationParameters(); parameters.Add(nameof(AddOrEdit), addOrEdit.ToString()); NavigationService.NavigateAsync(nameof(ProfileConfigurePage), parameters); }
public AddOrEditViewModel(IRecipesEndPointAPI RecipesEndPointAPI) { _recipesEndPointAPI = RecipesEndPointAPI; SubmitCommand = new Command(async() => await Submit()); AddIngredientCommand = new Command(async() => await AddIngredient()); DeleteIngredientCommand = new Command(async() => await DeleteIngredient()); SelectImageCommand = new Command(async() => await OpenFile()); DeleteImageCommand = new Command(async() => await DeleteFile()); Title = "Dodaj"; ImagePath = ImageConstants.LoadDefaultImage; SubmitText = "Dodaj"; MessagingService.Current.Unsubscribe <RecipeModel>(EventMessages.EditRecipeEvent); MessagingService.Current.Subscribe <RecipeModel>(EventMessages.EditRecipeEvent, (sender, arg) => { Title = "Edytuj"; _addOrEdit = AddOrEdit.Edit; _recipeId = arg.RecipeId; SubmitText = "Zaktualizuj"; RecipeName = arg.Name; RecipeIngredients = new ObservableCollection <string>(arg.Ingredients.ToList()); RecipeInstructions = arg.Instruction; ImagePath = arg.ImagePath; IsPublic = arg.IsPublic; OnPropertyChanged(nameof(CanDeleteImage)); }); }
public IActionResult AddOrEdit(AddOrEdit addOrEdit) { if (!this.ModelState.IsValid) { return(this.RedirectToAction("AddOrEdit")); } Data.Entities.Book book = addOrEdit.Id == null ? new Data.Entities.Book() : this.bookRepository.GetById((int)addOrEdit.Id); this.CreateOrUpdateLocalizationsFor(book); book.Year = addOrEdit.Year; if (addOrEdit.Id == null) { this.bookRepository.Create(book); } else { this.bookRepository.Update(book); } this.storage.SaveChanges(); return(this.RedirectToAction("Index")); }
public AddSongUI(GuitarPracticeTrackerUI mainUI) { InitializeComponent(); cbTuning.DataSource = Tunings.ListOfTunings; cbDifficulty.DataSource = Enum.GetValues(typeof(Difficulty)); addOrEdit = AddOrEdit.Add; btnAddSong.Text = "Add Song"; mainUIForm = mainUI; }
public AddSongUI(GuitarPracticeTrackerUI mainUI, Song song) { InitializeComponent(); tbArtist.Text = song.Artist; tbName.Text = song.Name; cbTuning.DataSource = Tunings.ListOfTunings; cbTuning.SelectedItem = Tunings.FindTuningByString(song.Tuning); cbDifficulty.DataSource = Enum.GetValues(typeof(Difficulty)); cbDifficulty.SelectedItem = song.Difficulty; songToEdit = song; addOrEdit = AddOrEdit.Edit; btnAddSong.Text = "Edit Song"; mainUIForm = mainUI; }
public IActionResult AddOrEdit(int?id) { AddOrEdit addOrEdit = new AddOrEdit(); if (id == null) { addOrEdit.NameLocalizations = this.CreateEmptyLocalizations(); } else { Data.Entities.Library library = this.libraryRepository.GetById((int)id); addOrEdit.NameLocalizations = this.CreateLocalizationsFor(library.Name); } return(this.View(addOrEdit)); }
public AddForm(Note _MyRecord, List <Note> _PhoneNote, AddOrEdit MyType) { InitializeComponent(); MyRecord = _MyRecord; PhoneNote = _PhoneNote; if (MyType == AddOrEdit.Add) { Text = "Добавление абонента"; AddButton.Text = "Добавить"; } else { Text = "Изменение абонента"; AddButton.Text = "Изменить"; LastNameTextBox.Text = MyRecord.LastName; NameTextBox.Text = MyRecord.Name; PatronymicTextBox.Text = MyRecord.Patronymic; PhoneMaskedTextBox.Text = MyRecord.Phone; StreetTextBox.Text = MyRecord.Street; HouseNumericUpDown.Value = MyRecord.House; FlatNumericUpDown.Value = MyRecord.Flat; } }
public AddForm(Note _MyRecord, AddOrEdit Type) { InitializeComponent(); MyRecord = _MyRecord; if (Type == AddOrEdit.Add) { Text = "Добавление абонента"; buttonAdd.Text = "Добавить"; } else // если форма открыта для изменения записи { Text = "Изменение абонента"; buttonAdd.Text = "Изменить"; // определяем значение компонентов на форме LastNameTextBox.Text = MyRecord.LastName; NameTextBox.Text = MyRecord.Name; PatronymicTextBox.Text = MyRecord.Patronymic; PhoneMaskedTextBox.Text = MyRecord.Phone; StreetTextBox.Text = MyRecord.Street; HouseNumericUpDown.Value = MyRecord.House; FlatNumericUpDown.Value = MyRecord.Flat; } }
public IActionResult AddOrEdit(int?id) { AddOrEdit addOrEdit = new AddOrEdit(); if (id == null) { addOrEdit.NameLocalizations = this.CreateEmptyLocalizations(); addOrEdit.DescriptionLocalizations = this.CreateEmptyLocalizations(); addOrEdit.AuthorLocalizations = this.CreateEmptyLocalizations(); addOrEdit.Year = DateTime.Now.Year; } else { Data.Entities.Book book = this.bookRepository.GetById((int)id); addOrEdit.NameLocalizations = this.CreateLocalizationsFor(book.Name); addOrEdit.DescriptionLocalizations = this.CreateLocalizationsFor(book.Description); addOrEdit.AuthorLocalizations = this.CreateLocalizationsFor(book.Author); addOrEdit.Year = book.Year; } return(this.View(addOrEdit)); }
public AddForm(List <Note> _PhoneNote, Note _MyRecord, AddOrEdit myType) { InitializeComponent(); PhoneNote = _PhoneNote; MyRecord = _MyRecord; CheckAdd = false;//флаг того, что в справочник добавится новый элемент if (myType == AddOrEdit.Add) { Text = "Добавление абонента"; AddButton.Text = "Добавить"; } else { Text = "Изменение абонента"; AddButton.Text = "Изменить"; LastNameTextBox.Text = MyRecord.LastName; NameTextBox.Text = MyRecord.Name; PatronymicTextBox.Text = MyRecord.Patronymic; PhoneMaskedTextBox.Text = MyRecord.Phone; StreetTextBox.Text = MyRecord.Street; HouseNumericUpDown.Value = MyRecord.House; FlatNumericUpDown.Value = MyRecord.Flat; } }
public async Task HandleAsync(SendRecipe message, CancellationToken cancellationToken) { try { if (message != null) { _addOrEdit = AddOrEdit.Edit; _recipeId = message.RecipeModel.RecipeId; SubmitText = "Zaktualizuj"; RecipeName = message.RecipeModel.Name; RecipeIngredients = new BindingList <string>(message.RecipeModel.Ingredients.ToList()); RecipeInstructions = message.RecipeModel.Instruction; ImagePath = message.RecipeModel.ImagePath; IsPublic = message.RecipeModel.IsPublic; } await Task.CompletedTask; } catch (Exception ex) { _logger.Error("Got exception", ex); } }
public Form2() { aoe = getIndexEdit; InitializeComponent(); SetCBBClass(); }
public AddRecipeWindowEvent(AddOrEdit addOrEdit, RecipeModel recipeModel = null) { RecipeModel = recipeModel; AddOrEdit = addOrEdit; }