Пример #1
0
        private void GetAllEntities()
        {
            lock (repositoryLocker)
            {
                try
                {
                    var entities = _repositoryProvider.GetAll();

                    foreach (var e in entities)
                    {
                        var newEntity = _converter.ToEntity(e);
                        _cachedDictionary.Add(newEntity.getId(), newEntity);
                    }
                }
                catch (Exception)
                {
                    throw new Exception("Cant get all entities");
                }
            }
        }
Пример #2
0
        public async Task <ActionResult> Index()
        {
            var repos = _repositories.GetAll();
            var tasks = _hometasks.GetHometaskTitles();

            var reposInfo = await Task.WhenAll(repos.AsParallel()
                                               .Select(async r => new ReposViewModel()
            {
                Repo   = r,
                Issues = await GetIssues(r.RelativeUrl, tasks)
            }));

            var statuses = reposInfo.SelectMany(repo => repo.Issues.Select(i => new { Key = Tuple.Create(repo.Repo.Name, i.Title), Value = i }))
                           .DistinctBy(n => n.Key)
                           .ToDictionary(k => k.Key, v => v.Value);

            return(View(new HometasksStatusViewModel {
                Repos = repos, Tasks = tasks, Issues = statuses
            }));
        }