Ejemplo n.º 1
0
        public ActionResult ChangeLanguage(ChangeLanguageModel model)
        {
            if (ModelState.IsValid)
            {
                User user = GetUserByLogin(model.Login);

                if (user != null)
                {
                    if (user.Culture != model.Culture)
                    {
                        user.Culture = model.Culture;
                        PrdnDBContext.SaveChanges();

                        SetSaveCurrentCulture(model.Culture);
                    }

                    return RedirectToAction("CurrentLanguage");
                }
                else {
                    ModelState.AddModelError(model.FullPropertyName(m => m.Login), "Invalid");
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Ejemplo n.º 2
0
        public ActionResult ChangeLanguage()
        {
            string login = GetCurrentUserLogin();

            User user = GetUserByLogin(login);

            if (user == null)
            {
                return ErrMsgView("Failed to find user for current login "+ login);
            }

            ChangeLanguageModel model = new ChangeLanguageModel { Login = user.Login, Culture = user.Culture };
            return View(model);
        }