public HttpResponseMessage Get() { try { var buildService = new BuildService(); var builds = buildService.GetBuilds().ToArray(); var columns = string.Concat(builds.Select(s => $@" <div class=""build-wrapper {s.Status}""> <div class=""build""> <a class=""nostyle"" href=""{s.WebUrl}""><h2>{s.BuildConfig.Project.Name}: {s.BuildConfig.Name}</h2></a> </div> </div>")); return(new HttpResponseMessage() { Content = new StringContent($@" <div class=""columns""> {columns} </div>", Encoding.UTF8, "text/html") }); } catch (Exception) { return(new HttpResponseMessage() { Content = new StringContent($@" <div class=""failbox blink""> <h2>Can not access TeamCity</h2> </div>" , Encoding.UTF8, "text/html") }); } }
// GET: Note public ActionResult Index() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new BuildService(userId); var model = service.GetBuilds(); return(View(model)); }
public Task <IEnumerable <Build> > GetBuilds() { return(_buildService.GetBuilds()); }
public void OnGet() { Builds = _context.GetBuilds(); }
public IActionResult Get() { return(Ok(_service.GetBuilds())); }
// GET public List <Build> All() { return(service.GetBuilds()); }