public List <ApplicationUser> GetUsersForEventNotification(WorkEvent @event) { var userIds = new List <ApplicationUser>(); switch (@event.Type) { case EventType.WorkItemChanged: case EventType.WorkItemStateChanged: case EventType.WorkItemAdded: case EventType.WorkItemDeleted: case EventType.WorkItemCommentAdded: // ReSharper disable once PossibleInvalidOperationException // Проверяется перед вызовом метода var workItem = _workItemRepository.GetByIdNoTracking(@event.ObjectId.Value); return(GetResponsibleUsers(workItem).Distinct(new ApplicationUserEqualityComparer()).ToList()); case EventType.WorkItemAppointed: case EventType.WorkItemDisappointed: return(new List <ApplicationUser> { _usersService.Get(@event.Data) }); case EventType.User: break; default: throw new ArgumentOutOfRangeException(); } return(userIds); }
public WorkItem GetWithNoTracking(int id) { var workItem = _repository.GetByIdNoTracking(id); if (workItem == null) { throw new PmsException(string.Format(Resources.WorkItemNotFound, id)); } return(workItem); }
public async Task <WorkItemHistoryDto> GetHistoryById(int workItemId) { var workItem = await _workItemRepository.GetByIdNoTracking(workItemId); return(_mapper.Map <WorkItem, WorkItemHistoryDto>(workItem)); }