public ApplicationUser ProjectDev(int Project) { UserRoleHelper helper = new UserRoleHelper(); var dev = helper.UsersInRole("Developer"); Project project = FindProject(Project); foreach (var d in dev) { if (project.Users.Contains(d)) { return d; } } return null; ; }
public bool ProjectHasDev(int Project) { UserRoleHelper helper = new UserRoleHelper(); var dev = helper.UsersInRole("Developer"); Project project = FindProject(Project); foreach (var d in dev) { if (project.Users.Contains(d)) { return true; } } return false; }
public ActionResult Edit(int? Id) { UserRoleHelper helper = new UserRoleHelper(); var pms = helper.UsersInRole("Project Manager"); var devs = helper.UsersInRole("Developer"); var project = db.Projects.Find(Id); var model = new ProjectUserViewModel() { Project = project, Pms = new MultiSelectList(pms, "Id", "UserName", project.Users.Select(u => u.Id)), Devs = new MultiSelectList(devs, "Id", "UserName", project.Users.Select(u => u.Id)), Ticket = null, }; return View(model); }
public bool ProjectHasPm(int Project) { UserRoleHelper helper = new UserRoleHelper(); var pms = helper.UsersInRole("Project Manager"); var project = FindProject(Project); foreach(var p in pms) { if(project.Users.Contains(p)) { return true; } } return false; }
public ApplicationUser ProjectPm(int Project) { UserRoleHelper helper = new UserRoleHelper(); var pms = helper.UsersInRole("Project Manager"); Project project = FindProject(Project); foreach (var p in pms) { if (project.Users.Contains(p)) { return p; } } return null; ; }
// GET: TicketModels/Edit/5 public ActionResult Edit(int? id) { UserRoleHelper helper = new UserRoleHelper(); var devs = helper.UsersInRole("Developer").ToList(); if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Ticket ticketModel = db.Tickets.Find(id); if (ticketModel == null) { return HttpNotFound(); } ViewBag.AssignedUserId = new SelectList(devs, "Id", "DisplayName", ticketModel.Id); ViewBag.OwnerId = new SelectList(db.Users, "Id", "FirstName", ticketModel.OwnerId); ViewBag.PriorityId = new SelectList(db.TicketPriorities, "Id", "Name", ticketModel.PriorityId); ViewBag.ProjectId = new SelectList(db.Projects, "Id", "Name", ticketModel.ProjectId); ViewBag.StatusId = new SelectList(db.TicketStatuses, "Id", "Name", ticketModel.StatusId); ViewBag.TypeId = new SelectList(db.TicketTypes, "Id", "Name", ticketModel.TypeId); return View(ticketModel); }
public ActionResult RoleRemove(ApplicationUser user, string RoleName) { UserRoleHelper helper = new UserRoleHelper(); if (helper.IsUserInRole(user.Id, RoleName)) { helper.RemoveUserFromRole(user.Id, RoleName); } return RedirectToAction("Index", "Home"); }
public ActionResult RoleAdd (ApplicationUser user, string RoleName) { UserRoleHelper helper = new UserRoleHelper(); if(!helper.IsUserInRole(user.Id,RoleName)) { helper.AddUserToRole(user.Id, RoleName); } return RedirectToAction("Users"); }