Esempio n. 1
0
        public ActionResult UpdateUser(AccountDraftViewModel model)
        {
            var textList = new[] { model.Login, model.Name, model.Password };

            if (textList.Any(string.IsNullOrWhiteSpace))
            {
                ViewBag.Errors = "Заполните обязательные поля.";
                return(View("Index", model));
            }

            if (model.Id == null && _homeService.CheckExistLogin(model.Login))
            {
                ViewBag.Errors = "Аккаунт с таким логином уже существует.";
                return(View("Index", model));
            }

            var accountId = _homeService.AddOrUpdateAccount(model, new BackgroundJobService());

            return(RedirectToAction("Index", "Users"));
        }