public static void Up() { const string adminRole = "admin"; const string readerRole = "reader"; const string librarianRole = "librarian"; const string providerRole = "provider"; if (!roles.RoleExists(adminRole)) { roles.CreateRole(adminRole); } if (!roles.RoleExists(readerRole)) { roles.CreateRole(readerRole); } if (!roles.RoleExists(librarianRole)) { roles.CreateRole(librarianRole); } if (!roles.RoleExists(providerRole)) { roles.CreateRole(providerRole); } //Создание аккаунта администратора const string admin = "admin"; const string adminPassword = "******"; if (membership.GetUser(admin, false) == null) { membership.CreateUserAndAccount(admin, adminPassword); if (!roles.IsUserInRole(admin, adminRole)) { roles.AddUsersToRoles(new[] { admin }, new[] { adminRole }); } } const string reader = "reader"; const string readerPassword = "******"; if (membership.GetUser(reader, false) == null) { membership.CreateUserAndAccount(reader, readerPassword); if (!roles.IsUserInRole(reader, readerRole)) { roles.AddUsersToRoles(new[] { reader }, new[] { readerRole }); } } const string librarian = "librarian"; const string librarianPassword = "******"; if (membership.GetUser(librarian, false) == null) { membership.CreateUserAndAccount(librarian, librarianPassword); if (!roles.IsUserInRole(librarian, librarianRole)) { roles.AddUsersToRoles(new[] { librarian }, new[] { librarianRole }); } } const string provider = "provider"; const string providerPassword = "******"; if (membership.GetUser(provider, false) == null) { membership.CreateUserAndAccount(provider, providerPassword); if (!roles.IsUserInRole(provider, providerRole)) { roles.AddUsersToRoles(new[] { provider }, new[] { providerRole }); } } }