Пример #1
0
        public async Task <ActionResult> Create(long taskId)
        {
            ViewBag.Repos = await GitHubInstance.GetStorageInstance().GetRepositoriesAsync();

            return(PartialView(new PullRequestCreateViewModel {
                TaskId = taskId
            }));
        }
Пример #2
0
        public async Task <ActionResult> Create(ReviewCreateViewModel reviewCreateViewModel)
        {
            var prd = _repository.PullRequestsDataManager.Get(p => p.Id == reviewCreateViewModel.PullRequestDataId);
            var pullRequestManager = await GitHubInstance.GetClientInstance().
                                     GetExistPullRequestManagerAsync(prd.RepositoryName, prd.PullRequestNumber);

            await pullRequestManager.ReviewRepository.
            CreateReviewAsync(reviewCreateViewModel.Body, reviewCreateViewModel.ReviewComments, reviewCreateViewModel.ReviewEvent);

            return(RedirectToAction("Index", "PullRequest", new
            {
                pullRequestDataId = reviewCreateViewModel.PullRequestDataId
            }));
        }
Пример #3
0
        public async Task <ActionResult> Chose(PullRequestChoseViewModel pullRequestModel)
        {
            if (ModelState.IsValid)
            {
                var id = await CreateHomeworkViaPullRequest(pullRequestModel.TaskId, pullRequestModel.RepositoryName, pullRequestModel.Number);

                return(id.HasValue ? RedirectToAction("Index", new { pullRequestDataId = id })
                                                                   : RedirectToAction("Index", "Home", new { errorMessage = "Ошибка при обновлении базы данных" }));
            }
            else
            {
                ViewBag.Repos = await GitHubInstance.GetStorageInstance().GetRepositoriesAsync();

                return(PartialView(pullRequestModel));
            }
        }
Пример #4
0
        public async Task <ActionResult> Index(long pullRequestDataId)
        {
            var prd         = _repository.PullRequestsDataManager.Get(p => p.Id == pullRequestDataId);
            var pullRequest = (await GitHubInstance.GetClientInstance().
                               GetExistPullRequestManagerAsync(prd.RepositoryName,
                                                               prd.PullRequestNumber))
                              .PullRequest;

            return(View(new PullRequestViewModel
            {
                PullRequest = pullRequest,
                MentorId = prd.MentorId,
                PullRequestDataId = pullRequestDataId,
                HomeworkId = prd.HomeworkId,
                OwnerId = prd.StudentId
            }));
        }
Пример #5
0
        public async Task <ActionResult> FillPullRequest(string repository)
        {
            var pullRequests = await GitHubInstance.GetStorageInstance().GetPullRequests(repository);

            return(Json(pullRequests, JsonRequestBehavior.AllowGet));
        }
Пример #6
0
        public async Task <ActionResult> FillBranch(string repository)
        {
            var branches = await GitHubInstance.GetStorageInstance().GetBranchesAsync(repository);

            return(Json(branches, JsonRequestBehavior.AllowGet));
        }