예제 #1
0
        public async Task <IActionResult> Connect([Bind("ID, Credential, Issues")] Project project)
        {
            if (ModelState.IsValid)
            {
                importService = ImportFactory.GetImportFrom("jira");
                //importService.Connect(new Credential()
                //{
                //    Uri = "https://queryexport.atlassian.net",
                //    Username = "******",
                //    Password = "******"
                //});
                //if (project.ID == 0)
                //{
                //    _context.Add(project);
                //    await _context.SaveChangesAsync();
                //}
                importService.Connect(new Credential()
                {
                    Uri      = project.Credential.Uri,
                    Username = project.Credential.Username,
                    Password = project.Credential.Password
                });

                var res = await importService.GetIssuesForProject();

                project.Issues = res;

                _context.Add(project);
                await _context.SaveChangesAsync();
            }
            return(RedirectToAction("Index"));
        }