public ActionResult Create(string sourceLangId,string targetLang) { if (sourceLangId == null) throw new ArgumentNullException("sourceLangId"); if (targetLang == null) throw new ArgumentNullException("targetLang"); ViewBag.Message = "Create Translation Webtext for Shorjini Kempo Camp Stockholm 2014 for language " + targetLang; WebTextTranslationViewModel webTextTranslationviewModel = null; WebText webTextSource = this.WebTextRepo.GetWebTextRepo(sourceLangId); if (webTextSource != null ) { webTextTranslationviewModel = new WebTextTranslationViewModel { SourceLang = webTextSource, TargetLang = new WebText { Lang = targetLang } }; } else { throw new NullReferenceException("Could not get source language webtext from WebTextRepo. Create for translation"); } return View(webTextTranslationviewModel); }
public ActionResult CreateTextItem(string view, string sourceLang) { if (view == null) throw new ArgumentNullException("view"); if (sourceLang == null) throw new ArgumentNullException("sourceLang"); ViewBag.Message = "Create Webtext for Shorjini Kempo Camp Stockholm 2014 for " + view; WebTextTranslationViewModel webTextTranslationviewModel = new WebTextTranslationViewModel { SourceLang = new WebText(){View = view,Lang = sourceLang}, TargetLang =null }; return View(webTextTranslationviewModel); }
// GET: /Fundlist/Edit/5 public ActionResult Edit(string SourceLangId, string TargetLangId) { if (SourceLangId == null) throw new ArgumentNullException("SourceLangId"); if (TargetLangId == null) throw new ArgumentNullException("TargetLangId"); ViewBag.Message = "Translate Shorjini Kempo Camp Stockholm 2014 for language " + SourceLangId; WebTextTranslationViewModel webTextTranslationviewModel = null; WebText webTextSource = this.WebTextRepo.GetWebTextRepo(SourceLangId); WebText webTextTarget = this.WebTextRepo.GetWebTextRepo(TargetLangId); var translateRepo = new TranslatorRepo(); string webTranslateToken = translateRepo.GetBingToken(); if (webTextSource != null && webTextTarget != null) { webTextTranslationviewModel = new WebTextTranslationViewModel { SourceLang = webTextSource, TargetLang = webTextTarget, AccessToken = webTranslateToken }; } else { throw new NullReferenceException("Could not get source or target language webtext from WebTextRepo.SearchWebText for translation"); } return View(webTextTranslationviewModel); }