public ActionResult Edit(EditUserModel model)
        {
            var userResult = GetLoggedInUser(new[] { Role.Administrator });

            if (userResult.GetType() == typeof(ActionResult))
            {
                return(userResult as ActionResult);
            }
            var user = userResult as User;

            model.User = user;

            var result = model.Save(this);

            if (result != null)
            {
                return(result);
            }

            var newModel = new UserBeheerModel {
                Sucess = "De gebruiker is aangemaakt/aangepast."
            };

            TempData["UserBeheerModel"] = newModel;
            return(RedirectToAction("Index"));
        }
Example #2
0
        public ActionResult Edit(EditUserModel user, FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                User actualUser = user.Save(_memberShipFactory);
                if (ProfileManager.Enabled)
                {
                    ProfileBase profile = ProfileBase.Create(actualUser.LoginId, true);

                    IEnumerator properites = ProfileBase.Properties.GetEnumerator();
                    if (properites != null)
                    {
                        while (properites.MoveNext())
                        {
                            var    property = properites.Current as SettingsProperty;
                            string v        = collection[property.Name];
                            profile[property.Name] = v;
                        }
                        profile.Save();
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(user));
        }
Example #3
0
        public IActionResult EditUser(EditUserModel model)
        {
            if (ModelState.IsValid)
            {
                model.Save();
                this.SetResultMessage($"<strong>Successfully updated</strong> {model.DisplayName}.");
            }

            return(RedirectToAction("Users"));
        }
Example #4
0
 public ActionResult EditUser(EditUserModel model)
 {
     if (!ModelState.IsValid)
     {
         return(View(model));
     }
     model.Save();
     if (model.Roles.Contains(UserRole.OrgManager.ToString()))
     {
         return(RedirectToAction("EditUser", new { id = model.EmployeeId }));
     }
     return(RedirectToAction("Users"));
 }