public string Post([FromBody] TranslationRequest request) { var svc = new TranslationServicesFacade(); var translatedHtml = svc.TranslateHtml(request.InputText, new[] { request.LanguageTag }).Object.SingleOrDefault()?.Translations.SingleOrDefault()?.Text; return(translatedHtml); }
static void Main(string[] args) { using (_service = new TranslationServicesFacade()) { var program = new Program(); var shouldExit = false; do { try { var optionCounter = 1; Console.Clear(); Console.WriteLine($"Process Id: {Process.GetCurrentProcess().Id}"); foreach (var option in program.Options) { var options = option.Value.ToArray(); Console.WriteLine(option.Key); for (int i = 0; i < options.Length; i++) { Console.WriteLine($" {(optionCounter++).ToString().PadLeft(2)} - {options[i].Value}"); } } Console.WriteLine(); Console.WriteLine(" 0 - Exit"); Console.WriteLine(); Console.WriteLine("Enter a value:"); var selection = Console.ReadLine() ?? string.Empty; shouldExit = (selection.Equals("0")); if (shouldExit) { return; } program.Execute(selection); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine("Press any key to continue..."); Console.ReadKey(); } } while (!shouldExit); } }