Пример #1
0
        public async Task <IActionResult> Post([FromBody] Update update)
        {
            _cultureService.SetCulture(update);

            try
            {
                await _telegramBotService.GetUpdates(update);
            }
            catch (Exception e)
            {
                return(Ok());
            }

            return(Ok());
        }
Пример #2
0
        public ActionResult ChangeLanguage(string culture, string returnUrl)
        {
            var cultureInfo = new CultureInfo(culture);

            if (!_applicationSettings.AcceptedCultures.Contains(cultureInfo))
            {
                throw new Exception(string.Format("{0} is not an accepted culture", culture));
            }

            _cultureService.SetCulture(cultureInfo, HttpContext);

            if (!Url.IsLocalUrl(returnUrl))
            {
                return(Redirect("/"));
            }

            return(Redirect(returnUrl));
        }