Exemplo n.º 1
0
        public ActionResult Assign(int Id, string AssignedToUserId)
        {
            TicketHelper.Assign(Id, AssignedToUserId);
            var developers          = UserHelper.GetUsersFromRole("Developer");
            var projectId           = db.Tickets.Find(Id).ProjectId;
            var developersOfProject = developers.Where(u => u.ProjectUsers.Any(pu => pu.ProjectId == projectId)).ToList();

            ViewBag.AssignedToUserId = new SelectList(developersOfProject, "Id", "Email");
            ViewBag.Id = Id;

            TicketNotificationHelper.AddNotification(Id, AssignedToUserId, NotificationType.AssignedBy, User.Identity.GetUserName());

            db.SaveChanges();
            db.Dispose();
            return(RedirectToAction("Index", "Projects", new { userId = User.Identity.GetUserId() }));
        }