public ActionResult Create(CreateUserModel model)
        {
            if (ModelState.IsValid)
            {
                MembershipCreateStatus creationStatus = MembershipCreateStatus.ProviderError;
                Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, out creationStatus);
                if (creationStatus == MembershipCreateStatus.Success)
                {
                    if (model.IsAdmin)
                        Roles.AddUserToRole(model.UserName, "admin");
                }
                else
                {
                    ModelState.AddModelError("", " خطا در ایجاد حساب کاربری : " + creationStatus.ToString());
                    return View();
                }
            }

            return RedirectToAction("Manage");
        }
        public ActionResult Edit(string id)
        {
            var user = Membership.GetUser(id);
            if (user != null)
            {
                CreateUserModel usermodel = new CreateUserModel()
                {
                    UserName = user.UserName,
                    Email = user.Email,
                    IsAdmin = Roles.IsUserInRole(user.UserName, "admin")
                };

                return View(usermodel);
            }
            else
                return HttpNotFound();
        }
        public ActionResult Edit(CreateUserModel model)
        {
            MembershipUser user = Membership.GetUser(model.UserName);
            if (user != null)
            {
                //update user admin role
                if (model.IsAdmin)
                {
                    if (!Roles.IsUserInRole(user.UserName, "admin"))
                        Roles.AddUserToRole(user.UserName, "admin");
                }
                else
                {
                    if (Roles.IsUserInRole(user.UserName, "admin"))
                        Roles.RemoveUserFromRole(user.UserName, "admin");
                }

                //update user email
                user.Email = model.Email;
                Membership.UpdateUser(user);

                return RedirectToAction("Manage");
            }
            else
                return HttpNotFound();
        }