Ejemplo n.º 1
0
        public ActionResult Index(TranslateViewModel tvm)
        {
            tvm.MatchSettings.ShowSentences = false; // required for matching
            _settingsServiceFacade.UpdateSettings(tvm.MatchSettings, tvm.SampleSettings);
            tvm.LastSearch = tvm.Match.TextIn;

            var getmatch = _translateServiceFacade.GetMatchFor(tvm.Match);

            if (getmatch.MatchesSuccessfullyFound)
            {
                var screen = _translateServiceFacade.GetCurrentScreen();
                var clause = screen.ScreenModel as FullClauseScreenModel;

                // let's add to the existing list
                var tp = new TranslatePair
                {
                    Source = tvm.LastSearch,
                    Target = clause.Translation
                };

                tvm.Translations.Add(tp);
            }

            return(View(tvm));
        }
        public TranslateViewModel GetTranslation(string sourceText, string target, string formality)
        {
            var tvm = MakeTranslateViewModel(sourceText, target, formality);
            _settingsServiceFacade.UpdateSettings(tvm.MatchSettings, tvm.SampleSettings);

            var getmatch = _translateServiceFacade.GetMatchFor(tvm.Match);

            if (getmatch.MatchesSuccessfullyFound)
            {
                var screen = _translateServiceFacade.GetCurrentScreen();
                var clause = screen.ScreenModel as FullClauseScreenModel;

                // let's add to the existing list
                var tp = new TranslatePair
                {
                    Source = tvm.LastSearch,
                    Target = clause.Translation
                };

                tvm.Translations.Add(tp);
            }

            return tvm;
        }