コード例 #1
0
        public ActionResult Edit(int?id)
        {
            var model = new EditTicketViewModel();

            userId = User.Identity.GetUserId();

            var currentTicket = bugTrackerHelper.GetCurrentTicketById(id.Value);

            model = Mapper.Map <EditTicketViewModel>(currentTicket);

            model.Types      = bugTrackerHelper.GetDropDownListTypes();
            model.Priorities = bugTrackerHelper.GetDropDownListPriorities();

            if (User.IsInRole("Admin") || User.IsInRole("ProjectManager"))
            {
                model.Statuses = bugTrackerHelper.GetDropDownListStatuses();
                model.Projects = bugTrackerHelper.GetDropDownListProjects();
            }
            else
            {
                model.Projects = bugTrackerHelper.GetDropDownListUsersProjectsEdit(userId, currentTicket.ProjectId);
            }

            return(View(model));
        }