private async Task<PRRequestModel> GetModel(WebUserNotifier webUserNotifier, PRRequestModel model, string accessToken) { if (model == null) { model = new PRRequestModel(); } var username = await GetGithubUserName(); var branchFetcher = new BranchFetcher(webUserNotifier); var branches = await branchFetcher.GetAllBranchNames(accessToken, username, "mi"); var availableTargetBranches = await branchFetcher.GetAllBranchNames(accessToken, "grantadesign", "mi"); var repositoryFetcher = new RepositoryFetcher(webUserNotifier); var repositories = await repositoryFetcher.GetAllRepositoryNames(accessToken, "grantadesign"); model.Repositories = repositories; model.Repository = "mi"; model.Branches = branches; model.AvailableTargetBranches = availableTargetBranches; model.Messages = webUserNotifier.Messages; return model; }
public async Task<ActionResult> Submit(PRRequestModel model) { var accessToken = await GetGithubToken(); var webUserNotifier = new WebUserNotifier(); var linkedPrCreator = new LinkedPrCreator(accessToken, model.BranchName, model.JiraIssueId, model.PullRequestTitle, model.Description, "grantadesign", "mi", webUserNotifier); var branchDefinitions = CreateBranchDefinitions(model.TargetBranches); await linkedPrCreator.MakeLinkedPullRequests(branchDefinitions, model.AddLinksToJira, model.SetJiraIssuePendingMerge); return View("Index", await GetModel(webUserNotifier, model, accessToken)); }