public IActionResult FinishNewTranslation(NewWordModel model) { var word = WordsService.Get(model.TranslationForID); if (word == default) { return(ShowErrorViewForNotFoundWord(model.TranslationForID)); } var language = LanguagesService.Get(model.WordLanguageID); var newWord = new Word(word.MasterWord, model.WordText, language); EditEntityModel.FillUpWord(model, newWord, language); TryOrAlert(model, () => WordsService.Add(newWord)); if (model.AlertType == default) { return(RedirectToAction("Word", new { id = newWord.ID })); } else { model.AvailableLanguages = LanguagesService.GetAll() .Where(lang => word[lang.ID] == default && lang.ID != word.LanguageID).ToArray(); return(View("NewTranslation", model)); } }
public IActionResult NewTranslation(int id) { var word = WordsService.Get(id); if (word == default) { return(ShowErrorViewForNotFoundWord(id)); } var model = new NewWordModel(); model.TranslationForID = id; model.AvailableLanguages = LanguagesService.GetAll() .Where(lang => word[lang.ID] == default && lang.ID != word.LanguageID).ToArray(); return(View(model)); }