예제 #1
0
        private async Task <ObjectivesListViewModel> GetObjectiveModelForUser(Guid userId)
        {
            var objectives = await _objectivesRepository.GetObjectivesByUserId(userId);

            return(new ObjectivesListViewModel
            {
                UserId = userId,
                IsObjectivesForCurrentUser = userId == Guid.Parse((await _currentContext.GetCurrentUser()).Id),
                Objectives = objectives.Select(x => new ObjectiveListItemViewModel
                {
                    Id = x.Id,
                    Title = x.Title,
                    KeyResults = x.KeyResults.Select(y => new KeyResultListItemViewModel {
                        Id = y.Id, Description = y.Description
                    }).ToList()
                }).ToList()
            });
        }