public ActionResult Create(ContentManager contentManager)
        {
            if (ModelState.IsValid)
            {
                if (!Roles.RoleExists(Constants.ROLE_CONTENT_MANAGER))
                    Roles.CreateRole(Constants.ROLE_CONTENT_MANAGER);

                var status = MembershipCreateStatus.UserRejected;

                if (Membership.GetUser(contentManager.Login) == null)
                    Membership.CreateUser(contentManager.Login, contentManager.Password, "*****@*****.**", "Capital of Russia", "Moscow", true, out status);
                else
                {
                    ViewBag.ErrorMessage = "Пользователь с таким логином существует.";
                    return View(contentManager);
                }

                if (status == MembershipCreateStatus.Success)
                {
                    var profile = new UserProfile(contentManager.Login)
                                      {
                                          FirstName = contentManager.FirstName,
                                          MiddleName = contentManager.MiddleName,
                                          LastName = contentManager.LastName
                                      };
                    profile.Save();

                    if (!Roles.IsUserInRole(contentManager.Login, Constants.ROLE_CONTENT_MANAGER))
                        Roles.AddUserToRole(contentManager.Login, Constants.ROLE_CONTENT_MANAGER);
                }

                return RedirectToAction("Index");
            }
            else return View(contentManager);
        }
        public ActionResult Index()
        {
            var contentManagers = new List<ContentManager>();

            if (Roles.RoleExists(Constants.ROLE_CONTENT_MANAGER))
            {
                string[] users = Roles.GetUsersInRole(Constants.ROLE_CONTENT_MANAGER);

                foreach (string username in users)
                {
                    var profile = new UserProfile(username);
                    var contentManager = new ContentManager() { Login = username, Password = string.Empty, Repeat = string.Empty, FirstName = profile.FirstName, MiddleName = profile.MiddleName, LastName = profile.LastName };
                    contentManagers.Add(contentManager);
                }
            }

            contentManagers = contentManagers.AsQueryable().OrderBy(item => item.LastName).ToList();
            return View(contentManagers);
        }
 public ActionResult Create()
 {
     var contentManager = new ContentManager();
     return View(contentManager);
 }