public RoleMenusController(IRoleMenuService roleMenuService, IUnitOfWorkAsync unitOfWork, IMenuItemService menuItemService, ApplicationRoleManager roleManager) { _roleMenuService = roleMenuService; _menuItemService = menuItemService; _roleManager = roleManager; _unitOfWork = unitOfWork; }
public IdentityUnitOfWork(string connectionString) { _db = new ApplicationContext(connectionString); _userManager = new ApplicationUserManager(new UserStore<ApplicationUser>(_db)); _roleManager = new ApplicationRoleManager(new RoleStore<ApplicationRole>(_db)); _clientManager = new ClientManager(_db); }
public IdentityModelHelper(ApplicationUserManager userManager, ApplicationRoleManager roleManager) { Contract.Assert(null != userManager); Contract.Assert(null != roleManager); _userManager = userManager; _roleManager = roleManager; }
public bool CreateRole(string name) { var rm = new ApplicationRoleManager( new RoleStore<IdentityRole>(context)); var idResult = rm.Create(new IdentityRole(name)); return idResult.Succeeded; }
protected async void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); // ユーザーとロールの初期化 // ロールの作成 var roleManager = new ApplicationRoleManager(new UserStore()); await roleManager.CreateAsync(new ApplicationRole { Name = "admin" }); await roleManager.CreateAsync(new ApplicationRole { Name = "users" }); var userManager = new ApplicationUserManager(new UserStore()); // 一般ユーザーの作成 await userManager.CreateAsync(new ApplicationUser { UserName = "******" }, "p@ssw0rd"); await userManager.AddToRoleAsync( (await userManager.FindByNameAsync("tanaka")).Id, "users"); // 管理者の作成 await userManager.CreateAsync(new ApplicationUser { UserName = "******" }, "p@ssw0rd"); await userManager.AddToRoleAsync( (await userManager.FindByNameAsync("super_tanaka")).Id, "users"); await userManager.AddToRoleAsync( (await userManager.FindByNameAsync("super_tanaka")).Id, "admin"); Debug.WriteLine("-----------"); }
public AccountController(ApplicationUserManager userManager, ApplicationRoleManager roleManager, ISecureDataFormat<AuthenticationTicket> accessTokenFormat) { RoleManager = roleManager; UserManager = userManager; AccessTokenFormat = accessTokenFormat; }
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, ApplicationRoleManager roleManager) { UserManager = userManager; SignInManager = signInManager; RoleManager = roleManager; }
public IdentityUnitOfWork(string connectionString) { db = new StoreContext(connectionString); UserManager = new ApplicationUserManager(new UserStore<ApplicationUser>(db)); RoleManager = new ApplicationRoleManager(new RoleStore<ApplicationRole>(db)); ClientManager = new ClientManager(db); }
public CourseTemplatesController(ApplicationDbContext context, ApplicationUserManager userManager, ApplicationRoleManager roleManager) { _context = context; _userManager = userManager; _roleManager = roleManager; }
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, IAuthenticationManager authenticationManager, ApplicationRoleManager roleManager) { this.userManager = userManager; this.signInManager = signInManager; this.authenticationManager = authenticationManager; this.roleManager = roleManager; }
public ApplicationPermissionManager(ApplicationDbContext context) { _db = context; _userManager = new ApplicationUserManager(_db); _roleManager = new ApplicationRoleManager(_db); _permissionStore = new ApplicationPermissionStore(_db); }
public AuthenticationRepository(IOwinContext owinContext) { userManager = owinContext.GetUserManager<ApplicationUserManager>(); roleManager = owinContext.Get<ApplicationRoleManager>(); authenticationManager = owinContext.Authentication; request = owinContext.Request; }
public UsersAdminController( ApplicationUserManager userManager, ApplicationRoleManager roleManager) { UserManager = userManager; RoleManager = roleManager; }
public RolesAdminController(ApplicationUserManager userManager, ApplicationRoleManager roleManager,ApplicationPermissionManager perManager) { UserManager = userManager; RoleManager = roleManager; PermissionManager = perManager; }
public ApplicationGroupManager() { _db = HttpContext.Current.GetOwinContext().Get<ApplicationDbContext>(); _userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>(); _roleManager = HttpContext.Current.GetOwinContext().Get<ApplicationRoleManager>(); _groupStore = new ApplicationGroupStore(_db); }
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, ApplicationRoleManager roleManager, ApplicationDbContext dbContext) { UserManager = userManager; SignInManager = signInManager; RoleManager = roleManager; AppDbContext = dbContext; }
public RoleService(ApplicationRoleManager roleManager, ApplicationUserManager userManager) { logger.Info("Start"); this.roleManager = roleManager; logger.Debug("roleManager: {0}", roleManager); this.userManager = userManager; logger.Debug("userManager: {0}", userManager); logger.Info("End"); }
public void CreateNewRole(Role model) { ApplicationRoleManager rm = new ApplicationRoleManager(new ApplicationRoleStore(new ApplicationDbContext())); rm.Create(new ApplicationRole(model.Name) { Id = Guid.NewGuid().ToString() }); }
public ProfileController() { roleManager = HttpContext.Current.GetOwinContext().Get<ApplicationRoleManager>(); userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>(); objectProvider = objectProvider == null ? new ObjectProvider() : objectProvider; unitOfWork = unitOfWork == null ? objectProvider.UnitOfWork : unitOfWork; aspNetUsersRepository = aspNetUsersRepository == null ? unitOfWork.AspNetUserRepository : aspNetUsersRepository; }
public ManageController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, ApplicationRoleManager roleManager, IUserService userService, ILog log, IQuestionService questionService) { UserManager = userManager; SignInManager = signInManager; RoleManager = roleManager; _userService = userService; _log = log; _questionService = questionService; }
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, ApplicationRoleManager roleManager, UserRolesTableRepository userRolesRepository) { UserManager = userManager; SignInManager = signInManager; RoleManager = roleManager; UserRolesRepository = userRolesRepository; }
public LessonController(ApplicationUserManager userManager, ApplicationRoleManager roleManager, IInstructorRepo instructorRepo, IPostalRepo postalRepo, IAutogearRepo autogearRepo, IStudentRepo studentRepo) { _userManager = userManager; _roleManager = roleManager; _instructorRepo = instructorRepo; _postalRepo = postalRepo; _autogearRepo = autogearRepo; _studentRepo = studentRepo; }
public static IEnumerable<ApplicationUser> GetUsersInRole(ApplicationRoleManager roleManager, ApplicationUserManager userManager, string roleName) { var role = roleManager.Roles.FirstOrDefault(r => r.Name == roleName); var roleId = role.Id; var users = userManager.Users.ToList(); var usersInRole = users.Where(x => x.Roles.Select(r => r.RoleId).Contains(roleId)).OrderBy(u => u.LfName); return usersInRole; }
public MeetingsController(ApplicationDbContext context, ICurrentUser currentUser, IEmailService emailService, ApplicationUserManager userManager, ApplicationRoleManager roleManager) { _context = context; _currentUser = currentUser; _emailService = emailService; _userManager = userManager; _roleManager = roleManager; }
public static IEnumerable<ApplicationUser> GetCourseAuthors(ApplicationRoleManager roleManager, ApplicationUserManager userManager) { var role = roleManager.Roles.FirstOrDefault(r => r.Name == "Course Author"); var roleId = role.Id; var users = userManager.Users.ToList(); var courseAuthors = users.Where(x => x.Roles.Select(r => r.RoleId).Contains(roleId)).OrderBy(u=>u.LfName); return courseAuthors; }
/// <summary> /// designed to be used with seed method /// </summary> /// <param name="roleManger"></param> /// <param name="userManager"></param> public ApplicationGroupManager(ApplicationRoleManager roleManger, ApplicationUserManager userManager) { _db = new ApplicationDbContext(); _groupStore = new ApplicationGroupStore(_db); _userManager = userManager; _roleManager = roleManger; }
public IEnumerable<ApplicationRoleViewModel> Get() { var context = ApplicationDbContext.Create(); var roleManager = new ApplicationRoleManager(new RoleStore<ApplicationRole>(context)); return roleManager.Roles.Select(x=>new ApplicationRoleViewModel { Name = x.Name, RoleId = x.Id }); }
public UsersController(IUOW uow, NLog.ILogger logger, ApplicationRoleManager roleManager, ApplicationSignInManager signInManager, ApplicationUserManager userManager, IAuthenticationManager authenticationManager) { _logger = logger; _roleManager = roleManager; _signInManager = signInManager; _userManager = userManager; _authenticationManager = authenticationManager; _uow = uow; _logger.Debug("InstanceId: " + _instanceId); }
public DatabaseSeeder(ApplicationUserManager userManager, ApplicationRoleManager roleManager) { if (userManager == null) throw new ArgumentNullException(nameof(userManager)); if (roleManager == null) throw new ArgumentNullException(nameof(roleManager)); this.userManager = userManager; this.roleManager = roleManager; }
// See http://bitoftech.net/2015/03/11/asp-net-identity-2-1-roles-based-authorization-authentication-asp-net-web-api/ public static ApplicationRoleManager CreateApplicationRoleManager( IdentityFactoryOptions<ApplicationRoleManager> options, IOwinContext context) { var appRoleManager = new ApplicationRoleManager( new ApplicationRoleStore( context.Get<UrfIdentityDataContext>())); return appRoleManager; }
// public UsersAdminController(ApplicationUserManager userManager, ApplicationRoleManager roleManager) : base() { UserManager = userManager; RoleManager = roleManager; }
protected override void Seed(ProdDBContext context) { var userManager = new ApplicationUserManager(new CustomUserStore(context)); var roleManager = new ApplicationRoleManager(new CustomRoleStore(context)); var role1 = new CustomRole("user"); var role2 = new CustomRole("admin"); roleManager.Create(role1); roleManager.Create(role2); var admin = new ApplicationUser() { Email = "*****@*****.**", UserName = "******", UserInfo = new UserInfo() { Name = "Myk", Login = "******", DateRegistration = DateTime.Now } }; var result = userManager.Create(admin, "111111"); var user1 = new ApplicationUser() { Email = "*****@*****.**", UserName = "******", UserInfo = new UserInfo() { Name = "Kos", Login = "******", DateRegistration = DateTime.Now } }; var result2 = userManager.Create(user1, "222222"); var user2 = new ApplicationUser() { Email = "*****@*****.**", UserName = "******", UserInfo = new UserInfo() { Name = "Jen", Login = "******", DateRegistration = DateTime.Now } }; var result3 = userManager.Create(user2, "333333"); // min 6 characters context.SaveChanges(); if (result.Succeeded && result2.Succeeded && result3.Succeeded) { userManager.AddToRole(admin.Id, role1.Name); userManager.AddToRole(admin.Id, role2.Name); userManager.AddToRole(user1.Id, role1.Name); userManager.AddToRole(user2.Id, role1.Name); } context.SaveChanges(); Product pr1 = new Product() { ProductName = "FCV-123", ProductPrice = 122.21f }; Product pr2 = new Product() { ProductName = "CVB-1763", ProductPrice = 100.10f }; Product pr3 = new Product() { ProductName = "CFHB-17EB", ProductPrice = 10000.10f }; Product pr4 = new Product() { ProductName = "CFDFC-43E", ProductPrice = 12000.10f }; context.Products_.AddRange(new[] { pr1, pr2, pr3, pr4 }); context.SaveChanges(); Order or1 = new Order() { OrderDate = new DateTime(2018, 5, 1, 8, 30, 52) }; Order or2 = new Order() { OrderDate = new DateTime(2018, 6, 11, 8, 30, 50) }; context.Orders_.AddRange(new[] { or1, or2 }); context.SaveChanges(); OrderDetail od1 = new OrderDetail() { Product = pr1, Quantity = 2, Order = or1, UserInfoId = 2 }; OrderDetail od2 = new OrderDetail() { Product = pr2, Quantity = 3, Order = or1, UserInfoId = 2 }; OrderDetail od3 = new OrderDetail() { Product = pr3, Quantity = 1, Order = or2, UserInfoId = 3 }; OrderDetail od4 = new OrderDetail() { Product = pr4, Quantity = 4, Order = or2, UserInfoId = 3 }; context.OrderDetails_.AddRange(new[] { od1, od2, od3, od4 }); context.SaveChanges(); }
public EFUnitOfWork(string connectionString) { db = new ProductControlContext(connectionString); userManager = new ApplicationUserManager(new UserStore <ApplicationUser>(db)); roleManager = new ApplicationRoleManager(new RoleStore <ApplicationRole>(db)); }
public ActionResult RoleIndex() { List <ApplicationRole> _roles = ApplicationRoleManager.GetRoles(); return(View(_roles)); }
public PartialViewResult AddUser2RoleReturnPartialView(int id, int userId) { ApplicationUserManager.AddUser2Role(userId, id); return(PartialView("_ListUsersTable4Role", ApplicationRoleManager.GetRole(id))); }
public ActionResult RoleDelete(int id) { ApplicationRoleManager.DeleteRole(id); return(RedirectToAction("RoleIndex")); }
public bool RoleExists(ApplicationRoleManager roleManager, string name) { return(roleManager.RoleExists(name)); }
public bool CreateRole(ApplicationRoleManager _roleManager, string name, string description = "") { var idResult = _roleManager.Create <ApplicationRole, string>(new ApplicationRole(name, description)); return(idResult.Succeeded); }
public RolesAdminController(ApplicationUserManager userManager, ApplicationRoleManager roleManager) { UserManager = userManager; RoleManager = roleManager; }
// GET: Admin public ActionResult Index(string sortOrder, string currentFilter, string searchString, int?page) { ApplicationUserManager UserManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>(); ApplicationRoleManager roleManager = HttpContext.GetOwinContext().Get <ApplicationRoleManager>(); ViewBag.CurrentSort = sortOrder; ViewBag.FirstnameSortParm = string.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; ViewBag.SurnameSortParm = sortOrder == "Surname" ? "surname_desc" : "Surname"; ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date"; string role = roleManager.FindByName("Employee").Id; var users = db.Users.Where(x => x.Roles.Select(y => y.RoleId).Contains(role)); //Pagging if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; //Sorting if (!string.IsNullOrEmpty(searchString)) { users = users.Where(s => s.UserName.Contains(searchString)); } switch (sortOrder) { case "name_desc": users = users.OrderByDescending(s => s.Firstname); break; case "Date": users = users.OrderBy(s => s.BirthDate); break; case "date_desc": users = users.OrderByDescending(s => s.BirthDate); break; case "Surname": users = users.OrderBy(s => s.Surname); break; case "surname_desc": users = users.OrderByDescending(s => s.Surname); break; default: users = users.OrderBy(s => s.Firstname); break; } int pageSize = 5; int pageNumber = (page ?? 1); return(View(users.ToPagedList(pageNumber, pageSize))); }
public RoleRepository(IdentityDbContext <ApplicationUser> db) { _roleManager = new ApplicationRoleManager(new RoleStore <ApplicationRole>(db));; }
protected void Page_Load(object sender, EventArgs e) { userMgr = Context.GetOwinContext().GetUserManager <ApplicationUserManager>(); roleMgr = Context.GetOwinContext().Get <ApplicationRoleManager>(); }
public bool Seed(ApplicationDbContext context) { bool success = false; ApplicationRoleManager _roleManager = new ApplicationRoleManager(new RoleStore <ApplicationRole>(context)); success = this.CreateRole(_roleManager, RolesConst.ADMIN, "Global Access"); if (!success == true) { return(success); } success = this.CreateRole(_roleManager, RolesConst.CUSTOMER, "Customer"); if (!success == true) { return(success); } success = this.CreateRole(_roleManager, RolesConst.ACCOUNTANT, "Pidrahyu"); if (!success == true) { return(success); } success = this.CreateRole(_roleManager, RolesConst.PROGRAMER, "Make work"); if (!success == true) { return(success); } success = this.CreateRole(_roleManager, RolesConst.HR, "Human Resourse Management"); if (!success == true) { return(success); } success = this.CreateRole(_roleManager, RolesConst.OPERATOR, "Proceed Orders"); if (!success == true) { return(success); } success = this.CreateRole(_roleManager, RolesConst.RESOURSE_MANAGER, "Manage Resourses"); if (!success == true) { return(success); } success = this.CreateRole(_roleManager, RolesConst.Sales_MANAGER, "Sales Manager"); if (!success == true) { return(success); } success = this.CreateRole(_roleManager, RolesConst.MANAGER, "Manager"); if (!success == true) { return(success); } success = this.CreateRole(_roleManager, RolesConst.ORDER_OPERATOR, "Order Manaher"); if (!success == true) { return(success); } // Create my debug (testing) objects here ApplicationUserManager userManager = new ApplicationUserManager(new UserStore <ApplicationUser>(context)); ApplicationUser user = new ApplicationUser(); PasswordHasher passwordHasher = new PasswordHasher(); user.UserName = "******"; user.Email = "*****@*****.**"; user.RoleName = RolesConst.ADMIN; user.FistName = RolesConst.ADMIN; user.LastName = RolesConst.ADMIN; IdentityResult result = userManager.Create(user, "Pas@123"); success = this.AddUserToRole(userManager, user.Id, RolesConst.ADMIN); if (!success) { return(success); } ApplicationUser user2 = new Customer(); PasswordHasher passwordHasher2 = new PasswordHasher(); user2.UserName = "******"; user2.RoleName = RolesConst.CUSTOMER; user2.Email = "*****@*****.**"; user2.FistName = RolesConst.CUSTOMER; user2.LastName = RolesConst.CUSTOMER; IdentityResult result2 = userManager.Create(user2, "Pas@123"); success = this.AddUserToRole(userManager, user2.Id, RolesConst.CUSTOMER); if (!success) { return(success); } ApplicationUser user3 = new ApplicationUser(); PasswordHasher passwordHasher3 = new PasswordHasher(); user3.UserName = "******"; user3.Email = "*****@*****.**"; user3.RoleName = RolesConst.ACCOUNTANT; user3.FistName = RolesConst.ACCOUNTANT; user3.LastName = RolesConst.ACCOUNTANT; IdentityResult result3 = userManager.Create(user3, "Pas@123"); success = this.AddUserToRole(userManager, user3.Id, RolesConst.ACCOUNTANT); if (!success) { return(success); } ApplicationUser user4 = new ApplicationUser(); PasswordHasher passwordHasher4 = new PasswordHasher(); user4.UserName = "******"; user4.Email = "*****@*****.**"; user4.RoleName = RolesConst.PROGRAMER; user4.FistName = RolesConst.PROGRAMER; user4.LastName = RolesConst.PROGRAMER; IdentityResult result4 = userManager.Create(user4, "Pas@123"); success = this.AddUserToRole(userManager, user4.Id, RolesConst.PROGRAMER); if (!success) { return(success); } ApplicationUser user5 = new ApplicationUser(); PasswordHasher passwordHasher5 = new PasswordHasher(); user5.UserName = "******"; user5.Email = "*****@*****.**"; user5.RoleName = RolesConst.OPERATOR; user5.FistName = RolesConst.OPERATOR; user5.LastName = RolesConst.OPERATOR; IdentityResult result5 = userManager.Create(user5, "Pas@123"); success = this.AddUserToRole(userManager, user5.Id, RolesConst.OPERATOR); if (!success) { return(success); } ApplicationUser user6 = new ApplicationUser(); PasswordHasher passwordHasher6 = new PasswordHasher(); user6.UserName = "******"; user6.Email = "*****@*****.**"; user6.RoleName = RolesConst.Sales_MANAGER; user6.FistName = RolesConst.Sales_MANAGER; user6.LastName = RolesConst.Sales_MANAGER; IdentityResult result6 = userManager.Create(user6, "Pas@123"); success = this.AddUserToRole(userManager, user6.Id, RolesConst.Sales_MANAGER); if (!success) { return(success); } ApplicationUser user7 = new ApplicationUser(); PasswordHasher passwordHasher7 = new PasswordHasher(); user7.UserName = "******"; user7.Email = "*****@*****.**"; user7.RoleName = RolesConst.Sales_MANAGER; user7.FistName = RolesConst.Sales_MANAGER; user7.LastName = RolesConst.Sales_MANAGER; IdentityResult result7 = userManager.Create(user7, "Pas@123"); success = this.AddUserToRole(userManager, user7.Id, RolesConst.Sales_MANAGER); if (!success) { return(success); } ApplicationUser user8 = new ApplicationUser(); PasswordHasher passwordHasher8 = new PasswordHasher(); user8.UserName = "******"; user8.Email = "*****@*****.**"; user8.RoleName = RolesConst.CUSTOMER; user8.FistName = RolesConst.CUSTOMER; user8.LastName = RolesConst.CUSTOMER; IdentityResult result8 = userManager.Create(user8, "Pas@123"); success = this.AddUserToRole(userManager, user8.Id, RolesConst.CUSTOMER); if (!success) { return(success); } Customer user9 = new Customer(); PasswordHasher passwordHasher9 = new PasswordHasher(); user9.UserName = "******"; user9.Email = "*****@*****.**"; user9.RoleName = RolesConst.CUSTOMER; user9.FistName = RolesConst.CUSTOMER; user9.LastName = RolesConst.CUSTOMER; IdentityResult result9 = userManager.Create(user9, "Pas@123"); success = this.AddUserToRole(userManager, user9.Id, RolesConst.CUSTOMER); if (!success) { return(success); } ApplicationUser user10 = new ApplicationUser(); PasswordHasher passwordHasher10 = new PasswordHasher(); user10.UserName = "******"; user10.Email = "*****@*****.**"; user10.RoleName = RolesConst.MANAGER; user10.FistName = RolesConst.MANAGER; user10.LastName = RolesConst.MANAGER; IdentityResult result10 = userManager.Create(user10, "Pas@123"); success = this.AddUserToRole(userManager, user10.Id, RolesConst.MANAGER); if (!success) { return(success); } ApplicationUser user11 = new ApplicationUser(); PasswordHasher passwordHaser11 = new PasswordHasher(); user11.UserName = "******"; user11.Email = "*****@*****.**"; user11.RoleName = RolesConst.MANAGER; user11.FistName = RolesConst.MANAGER; user11.LastName = RolesConst.MANAGER + " II"; IdentityResult result11 = userManager.Create(user11, "Pas@123"); success = this.AddUserToRole(userManager, user11.Id, RolesConst.MANAGER); if (!success) { return(success); } if (!success) { return(success); } ApplicationUser user12 = new ApplicationUser(); PasswordHasher passwordHaser12 = new PasswordHasher(); user12.UserName = "******"; user12.Email = "*****@*****.**"; user12.RoleName = RolesConst.ORDER_OPERATOR; user12.FistName = RolesConst.ORDER_OPERATOR; user12.LastName = RolesConst.ORDER_OPERATOR; IdentityResult result12 = userManager.Create(user12, "Pas@123"); success = this.AddUserToRole(userManager, user12.Id, RolesConst.ORDER_OPERATOR); if (!success) { return(success); } Catagorie cat1 = new Catagorie() { Name = "Visitka" }; Catagorie blog = new Catagorie() { Name = "Blog" }; this.Catagories.Add(cat1); this.Catagories.Add(blog); this.SaveChanges(); ProductItem item1 = new ProductItem() { Name = "Шаблон 1", Price = 100, shortDescription = "blabla", description = "blablaballll", Categorie = TemplateSiteTypes.Shop }; ProductItem item2 = new ProductItem() { Name = "Шаблон 2", Price = 234, shortDescription = "blabla", description = "blablaballll", Categorie = TemplateSiteTypes.VisitCard }; this.ProductItems.Add(item1); this.ProductItems.Add(item2); WorkItem workItem = new WorkItem() { Name = "Шаблон 1", Description = "blabla", // hours, minutes, seconds DueDate = DateTime.Today + (new TimeSpan(12, 20, 20)), Status = TaskStatus.InProgress }; this.WorkItems.Add(workItem); WorkItem workItem1 = new WorkItem() { Name = "Шаблон 2", Description = "blablabla", // hours, minutes, seconds DueDate = DateTime.Today + (new TimeSpan(12, 20, 20)), Status = TaskStatus.InProgress }; this.WorkItems.Add(workItem); this.SaveChanges(); WorkItem workItem2 = new WorkItem() { Name = "Icon", Description = "wow", // hours, minutes, seconds DueDate = DateTime.Today + (new TimeSpan(12, 20, 20)), Status = TaskStatus.InProgress }; this.WorkItems.Add(workItem2); this.SaveChanges(); // DueDate = new DateTime(2015,05,12); Resourse r1 = new Resourse() { Name = "Reorce", Price = 20, Description = "One the rule them all " }; Resourse r2 = new Resourse() { Name = "Reorce2", Price = 40, Description = "One the rule them all " }; this.Resources.Add(r1); this.Resources.Add(r2); Order or1 = new Order() { completeDate = DateTime.Now, OrderDate = DateTime.Now, detailDescription = "mememe", orderStartus = OrderStatus.Initiating, Total = 200, customer = new Customer() { Email = "@", FistName = "A", LastName = "B", RoleName = RolesConst.CUSTOMER, UserName = "******" } }; this.Orders.Add(or1); Order or2 = new Order() { completeDate = DateTime.Now, OrderDate = DateTime.Now, detailDescription = "nyanyayna", orderStartus = OrderStatus.Processiong, Total = 150, }; Order or3 = new Order() { completeDate = DateTime.Now, OrderDate = DateTime.Now, detailDescription = "sysysy", orderStartus = OrderStatus.Initiating, Total = 600, }; this.Orders.Add(or2); this.Orders.Add(or3); Project project = new Project() { name = "MyProject", nameProjectManager = "*****@*****.**", costs = 300, projectStatus = ProjectStatus.Initial, projectManager = user10, order = or1, tasks = new List <WorkItem>() }; project.tasks.Add(workItem); project.tasks.Add(workItem1); this.Projects.Add(project); this.SaveChanges(); return(success); }
public RoleController(ApplicationRoleManager roleManager) { RoleManager = roleManager; }
public ViewResult PermissionIndex() { return(View(ApplicationRoleManager.GetPermissions())); }
private static void ImportSubMenus(ApplicationDbContext db, XmlNodeList nodes, int?parentId) { var SortOrder = 0; ApplicationRoleManager roleManager = new ApplicationRoleManager(new RoleStore <ApplicationRole>(db)); foreach (XmlNode node in nodes) { var sn = new SiteNavigationItem() { SortOrder = SortOrder++, AreaName = node["AreaName"].InnerText, ControllerName = node["ControllerName"].InnerText, ActionName = node["ActionName"].InnerText, ParentId = parentId }; sn.IsDivider = true; if (node["IsDivider"] == null) { sn.Text = node["Text"].InnerText; sn.Description = node["Description"].InnerText; sn.Icon = node["Icon"].InnerText; sn.IsDivider = false; } if (node["InDashboard"] != null) { sn.InNavBar = false; sn.InDashboard = Convert.ToBoolean(node["InDashboard"].InnerText); } db.SiteNavigationItems.Add(sn); db.SaveChanges(); /************************************************************************************** * Add role to menu Item **************************************************************************************/ foreach (XmlNode roles in node.SelectNodes("Roles")) { var roleName = roles["RoleName"].InnerText; var role = roleManager.FindByName(roleName); if (role != null) { var snr = new SiteNavigationRole() { MenuId = sn.Id, RoleId = role.Id }; db.SiteNavigationRoles.Add(snr); db.SaveChanges(); } } /************************************************************************************** * Add any sub-menus - if any exist **************************************************************************************/ if (node["SubMenu"] != null) { ImportSubMenus(db, node.SelectNodes("SubMenu"), sn.Id); } } }
public ServisController(ApplicationUserManager userManager, ApplicationRoleManager roleManager) { UserManager = userManager; RoleManager = roleManager; }
public PartialViewResult AddRole2PermissionReturnPartialView(int permissionId, int roleId) { ApplicationRoleManager.AddPermission2Role(roleId, permissionId); return(PartialView("_ListRolesTable4Permission", ApplicationRoleManager.GetPermission(permissionId))); }
public PartialViewResult DeleteUserFromRoleReturnPartialView(int id, int userId) { ApplicationUserManager.RemoveUser4Role(userId, id); return(PartialView("_ListUsersTable4Role", ApplicationRoleManager.GetRole(id))); }
public PartialViewResult DeleteRoleFromPermissionReturnPartialView(int id, int permissionId) { ApplicationRoleManager.RemovePermission4Role(id, permissionId); return(PartialView("_ListRolesTable4Permission", ApplicationRoleManager.GetPermission(permissionId))); }
private void SetViewBagData(string _userId) { ViewBag.UserId = _userId; ViewBag.List_boolNullYesNo = this.List_boolNullYesNo(); ViewBag.RoleId = new SelectList(ApplicationRoleManager.GetRoles4SelectList(), "Id", "Name"); }
public PartialViewResult DeletePermissionFromRoleReturnPartialView(int id, int permissionId) { ApplicationRoleManager.RemovePermission4Role(id, permissionId); return(PartialView("_ListPermissions", ApplicationRoleManager.GetRole(id))); }
public ConfirmEmailModel(UserManager <AppUser> userManager, ApplicationRoleManager roleManager) { _userManager = userManager; this.roleManager = roleManager; }
public PartialViewResult AddAllPermissions2RoleReturnPartialView(int id) { ApplicationRoleManager.AddAllPermissions2Role(id); return(PartialView("_ListPermissions", ApplicationRoleManager.GetRole(id))); }
public UserRepository(MovieDbContext context, ApplicationUserManager appUserManager, ApplicationRoleManager appRoleManager) : base(context) { _appUserManager = appUserManager; _appRoleManager = appRoleManager; }
public PartialViewResult DeletePermissionReturnPartialView(int id) { ApplicationRoleManager.DeletePermission(id); return(PartialView("_ListPermissionsTable", ApplicationRoleManager.GetPermissions())); }
public ManagementController(ApplicationUserManager userManager, ApplicationRoleManager roleManager) { this.userManager = userManager; this.roleManager = roleManager; }
public ViewResult PermissionDetails(int id) { return(View(ApplicationRoleManager.GetPermission(id))); }
public UserController(ApplicationRoleManager roleManager, ApplicationUserManager userManager) { RoleManager = roleManager; UserManager = userManager; }