public ActionResult EditUserVacationDays(EditUserVacationDaysViewModel model)
        {
            model.Vacations = _adminBusiness.GetUserVacationDictionary(model.Email);
            if (ModelState.IsValid)
            {
                string result = _adminBusiness.EditUserVacationDays(UserManager, model);
                if (!string.IsNullOrWhiteSpace(result))
                {
                    ModelState.AddModelError("", result);
                    return(View(model));
                }
                return(RedirectToAction("AdminUsersPanel"));
            }

            return(View(model));
        }
Ejemplo n.º 2
0
        //Возвращает строку с пречнем ошибок
        public string EditUserVacationDays(UserManager <ApplicationUser> userManager, EditUserVacationDaysViewModel model)
        {
            string result = "";

            if (!(model.VacationNames.Count == model.VacationDays.Count))
            {
                result = "Something went wrong! Please refresh and try again.";
                return(result);
            }
            ApplicationUser user = _adminData.GetUserByEmail(userManager, model.Email);

            return(_adminData.EditUserVacationDays(userManager, user, model.VacationNames, model.VacationDays));
        }