{"action":"created","comment":{"url":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/comments/195905697","pull_request_review_id":129366188,"id":195905697,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NTkwNTY5Nw==","diff_hunk":"@@ -1,42 +1,270 @@\n using System;\n+using System.Collections.Generic;\n using System.Threading.Tasks;\n using Microsoft.AspNetCore.Mvc;\n using Microsoft.Extensions.Logging;\n+using ServiceHub.Room.Context.Repository;\n+using ServiceHub.Room.Context.Utilities;\n \n namespace ServiceHub.Room.Service.Controllers\n {\n-  [Route(\"api/[controller]\")]\n-  public class RoomController : BaseController\n-  {\n-    public RoomController(ILoggerFactory loggerFactory) : base(loggerFactory) {}\n \n-    public async Task<IActionResult> Get()\n+    [Route(\"api/Rooms\")]\n+    public class RoomController : BaseController\n     {\n-      return await Task.Run(() => Ok());\n-    }\n+        private readonly RoomContext _context;\n \n-    [HttpGet(\"{id}\")]\n-    public async Task<IActionResult> Get(int id)\n-    {\n-      return await Task.Run(() => Ok());\n-    }\n+        public RoomController(ILoggerFactory loggerFactory, IRoomsRepository repo) : base(loggerFactory)\n+        {\n+            _context = new RoomContext(repo);\n+        }\n \n-    [HttpPost]\n-    public async Task<IActionResult> Post([FromBody]object value)\n-    {\n-      return await Task.Run(() => Ok());\n-    }\n+        /// <summary>\n+        /// Gets all records.\n+        /// </summary>\n+        /// <returns>All records, error code if failure occurs.</returns>\n+        [HttpGet]\n+        public async Task<IActionResult> Get()\n+        {\n+            List<Context.Models.Room> ctxRooms;\n+            try\n+            {\n+                ctxRooms = await Task.Run(() => _context.Get());","path":"src/ServiceHub.Room.Service/Controllers/RoomController.cs","position":49,"original_position":49,"commit_id":"1562189324508dfd100ce16dca608d1dc546374f","original_commit_id":"1562189324508dfd100ce16dca608d1dc546374f","user":{"login":"escalonn","id":2515013,"node_id":"MDQ6VXNlcjI1MTUwMTM=","avatar_url":"https://avatars0.githubusercontent.com/u/2515013?v=4","gravatar_id":"","url":"https://api.github.com/users/escalonn","html_url":"https://github.com/escalonn","followers_url":"https://api.github.com/users/escalonn/followers","following_url":"https://api.github.com/users/escalonn/following{/other_user}","gists_url":"https://api.github.com/users/escalonn/gists{/gist_id}","starred_url":"https://api.github.com/users/escalonn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/escalonn/subscriptions","organizations_url":"https://api.github.com/users/escalonn/orgs","repos_url":"https://api.github.com/users/escalonn/repos","events_url":"https://api.github.com/users/escalonn/events{/privacy}","received_events_url":"https://api.github.com/users/escalonn/received_events","type":"User","site_admin":false},"body":"the point is, your repository/context should be accessing the data source asynchronously, wherever possible, and then that asynchronousness bubbles up to everything that calls that. this `await Task.Run(() => Process())` is what we write to call heavy CPU-bound stuff that's not itself async. much more common, and applicable here, is I/O-bound async, where we use `await ProcessAsync()`. should not need any Task.Run in your controllers.","created_at":"2018-06-16T15:43:35Z","updated_at":"2018-06-16T15:50:56Z","html_url":"https://github.com/revaturecloud/servicehub-room/pull/20#discussion_r195905697","pull_request_url":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/20","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/comments/195905697"},"html":{"href":"https://github.com/revaturecloud/servicehub-room/pull/20#discussion_r195905697"},"pull_request":{"href":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/20","id":195278043,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1Mjc4MDQz","html_url":"https://github.com/revaturecloud/servicehub-room/pull/20","diff_url":"https://github.com/revaturecloud/servicehub-room/pull/20.diff","patch_url":"https://github.com/revaturecloud/servicehub-room/pull/20.patch","issue_url":"https://api.github.com/repos/revaturecloud/servicehub-room/issues/20","number":20,"state":"open","locked":false,"title":"Adding controller.","user":{"login":"cameron-wags","id":38019188,"node_id":"MDQ6VXNlcjM4MDE5MTg4","avatar_url":"https://avatars1.githubusercontent.com/u/38019188?v=4","gravatar_id":"","url":"https://api.github.com/users/cameron-wags","html_url":"https://github.com/cameron-wags","followers_url":"https://api.github.com/users/cameron-wags/followers","following_url":"https://api.github.com/users/cameron-wags/following{/other_user}","gists_url":"https://api.github.com/users/cameron-wags/gists{/gist_id}","starred_url":"https://api.github.com/users/cameron-wags/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cameron-wags/subscriptions","organizations_url":"https://api.github.com/users/cameron-wags/orgs","repos_url":"https://api.github.com/users/cameron-wags/repos","events_url":"https://api.github.com/users/cameron-wags/events{/privacy}","received_events_url":"https://api.github.com/users/cameron-wags/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-15T20:41:23Z","updated_at":"2018-06-16T15:50:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c08553ef6c3192c818c59184878eb80af4592c13","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/20/commits","review_comments_url":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/20/comments","review_comment_url":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/comments{/number}","comments_url":"https://api.github.com/repos/revaturecloud/servicehub-room/issues/20/comments","statuses_url":"https://api.github.com/repos/revaturecloud/servicehub-room/statuses/1562189324508dfd100ce16dca608d1dc546374f","head":{"label":"cameron-wags:controller","ref":"controller","sha":"1562189324508dfd100ce16dca608d1dc546374f","user":{"login":"cameron-wags","id":38019188,"node_id":"MDQ6VXNlcjM4MDE5MTg4","avatar_url":"https://avatars1.githubusercontent.com/u/38019188?v=4","gravatar_id":"","url":"https://api.github.com/users/cameron-wags","html_url":"https://github.com/cameron-wags","followers_url":"https://api.github.com/users/cameron-wags/followers","following_url":"https://api.github.com/users/cameron-wags/following{/other_user}","gists_url":"https://api.github.com/users/cameron-wags/gists{/gist_id}","starred_url":"https://api.github.com/users/cameron-wags/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cameron-wags/subscriptions","organizations_url":"https://api.github.com/users/cameron-wags/orgs","repos_url":"https://api.github.com/users/cameron-wags/repos","events_url":"https://api.github.com/users/cameron-wags/events{/privacy}","received_events_url":"https://api.github.com/users/cameron-wags/received_events","type":"User","site_admin":false},"repo":{"id":136482170,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY0ODIxNzA=","name":"servicehub-room-1","full_name":"cameron-wags/servicehub-room-1","owner":{"login":"cameron-wags","id":38019188,"node_id":"MDQ6VXNlcjM4MDE5MTg4","avatar_url":"https://avatars1.githubusercontent.com/u/38019188?v=4","gravatar_id":"","url":"https://api.github.com/users/cameron-wags","html_url":"https://github.com/cameron-wags","followers_url":"https://api.github.com/users/cameron-wags/followers","following_url":"https://api.github.com/users/cameron-wags/following{/other_user}","gists_url":"https://api.github.com/users/cameron-wags/gists{/gist_id}","starred_url":"https://api.github.com/users/cameron-wags/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cameron-wags/subscriptions","organizations_url":"https://api.github.com/users/cameron-wags/orgs","repos_url":"https://api.github.com/users/cameron-wags/repos","events_url":"https://api.github.com/users/cameron-wags/events{/privacy}","received_events_url":"https://api.github.com/users/cameron-wags/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cameron-wags/servicehub-room-1","description":"the apartment api.","fork":true,"url":"https://api.github.com/repos/cameron-wags/servicehub-room-1","forks_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/forks","keys_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/teams","hooks_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/hooks","issue_events_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/issues/events{/number}","events_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/events","assignees_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/assignees{/user}","branches_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/branches{/branch}","tags_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/tags","blobs_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/statuses/{sha}","languages_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/languages","stargazers_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/stargazers","contributors_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/contributors","subscribers_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/subscribers","subscription_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/subscription","commits_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/contents/{+path}","compare_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/merges","archive_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/downloads","issues_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/issues{/number}","pulls_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/pulls{/number}","milestones_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/milestones{/number}","notifications_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/labels{/name}","releases_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/releases{/id}","deployments_url":"https://api.github.com/repos/cameron-wags/servicehub-room-1/deployments","created_at":"2018-06-07T13:34:09Z","updated_at":"2018-06-15T15:33:44Z","pushed_at":"2018-06-15T21:53:56Z","git_url":"git://github.com/cameron-wags/servicehub-room-1.git","ssh_url":"git@github.com:cameron-wags/servicehub-room-1.git","clone_url":"https://github.com/cameron-wags/servicehub-room-1.git","svn_url":"https://github.com/cameron-wags/servicehub-room-1","homepage":null,"size":162,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"revaturecloud:157252833-room-controller","ref":"157252833-room-controller","sha":"9d680238e4a35ce912431288fe913a9af54bf02e","user":{"login":"revaturecloud","id":36998744,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2OTk4NzQ0","avatar_url":"https://avatars3.githubusercontent.com/u/36998744?v=4","gravatar_id":"","url":"https://api.github.com/users/revaturecloud","html_url":"https://github.com/revaturecloud","followers_url":"https://api.github.com/users/revaturecloud/followers","following_url":"https://api.github.com/users/revaturecloud/following{/other_user}","gists_url":"https://api.github.com/users/revaturecloud/gists{/gist_id}","starred_url":"https://api.github.com/users/revaturecloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/revaturecloud/subscriptions","organizations_url":"https://api.github.com/users/revaturecloud/orgs","repos_url":"https://api.github.com/users/revaturecloud/repos","events_url":"https://api.github.com/users/revaturecloud/events{/privacy}","received_events_url":"https://api.github.com/users/revaturecloud/received_events","type":"Organization","site_admin":false},"repo":{"id":131664729,"node_id":"MDEwOlJlcG9zaXRvcnkxMzE2NjQ3Mjk=","name":"servicehub-room","full_name":"revaturecloud/servicehub-room","owner":{"login":"revaturecloud","id":36998744,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2OTk4NzQ0","avatar_url":"https://avatars3.githubusercontent.com/u/36998744?v=4","gravatar_id":"","url":"https://api.github.com/users/revaturecloud","html_url":"https://github.com/revaturecloud","followers_url":"https://api.github.com/users/revaturecloud/followers","following_url":"https://api.github.com/users/revaturecloud/following{/other_user}","gists_url":"https://api.github.com/users/revaturecloud/gists{/gist_id}","starred_url":"https://api.github.com/users/revaturecloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/revaturecloud/subscriptions","organizations_url":"https://api.github.com/users/revaturecloud/orgs","repos_url":"https://api.github.com/users/revaturecloud/repos","events_url":"https://api.github.com/users/revaturecloud/events{/privacy}","received_events_url":"https://api.github.com/users/revaturecloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/revaturecloud/servicehub-room","description":"the apartment api.","fork":false,"url":"https://api.github.com/repos/revaturecloud/servicehub-room","forks_url":"https://api.github.com/repos/revaturecloud/servicehub-room/forks","keys_url":"https://api.github.com/repos/revaturecloud/servicehub-room/keys{/key_id}","collaborators_url":"https://api.github.com/repos/revaturecloud/servicehub-room/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/revaturecloud/servicehub-room/teams","hooks_url":"https://api.github.com/repos/revaturecloud/servicehub-room/hooks","issue_events_url":"https://api.github.com/repos/revaturecloud/servicehub-room/issues/events{/number}","events_url":"https://api.github.com/repos/revaturecloud/servicehub-room/events","assignees_url":"https://api.github.com/repos/revaturecloud/servicehub-room/assignees{/user}","branches_url":"https://api.github.com/repos/revaturecloud/servicehub-room/branches{/branch}","tags_url":"https://api.github.com/repos/revaturecloud/servicehub-room/tags","blobs_url":"https://api.github.com/repos/revaturecloud/servicehub-room/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/revaturecloud/servicehub-room/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/revaturecloud/servicehub-room/git/refs{/sha}","trees_url":"https://api.github.com/repos/revaturecloud/servicehub-room/git/trees{/sha}","statuses_url":"https://api.github.com/repos/revaturecloud/servicehub-room/statuses/{sha}","languages_url":"https://api.github.com/repos/revaturecloud/servicehub-room/languages","stargazers_url":"https://api.github.com/repos/revaturecloud/servicehub-room/stargazers","contributors_url":"https://api.github.com/repos/revaturecloud/servicehub-room/contributors","subscribers_url":"https://api.github.com/repos/revaturecloud/servicehub-room/subscribers","subscription_url":"https://api.github.com/repos/revaturecloud/servicehub-room/subscription","commits_url":"https://api.github.com/repos/revaturecloud/servicehub-room/commits{/sha}","git_commits_url":"https://api.github.com/repos/revaturecloud/servicehub-room/git/commits{/sha}","comments_url":"https://api.github.com/repos/revaturecloud/servicehub-room/comments{/number}","issue_comment_url":"https://api.github.com/repos/revaturecloud/servicehub-room/issues/comments{/number}","contents_url":"https://api.github.com/repos/revaturecloud/servicehub-room/contents/{+path}","compare_url":"https://api.github.com/repos/revaturecloud/servicehub-room/compare/{base}...{head}","merges_url":"https://api.github.com/repos/revaturecloud/servicehub-room/merges","archive_url":"https://api.github.com/repos/revaturecloud/servicehub-room/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/revaturecloud/servicehub-room/downloads","issues_url":"https://api.github.com/repos/revaturecloud/servicehub-room/issues{/number}","pulls_url":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls{/number}","milestones_url":"https://api.github.com/repos/revaturecloud/servicehub-room/milestones{/number}","notifications_url":"https://api.github.com/repos/revaturecloud/servicehub-room/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/revaturecloud/servicehub-room/labels{/name}","releases_url":"https://api.github.com/repos/revaturecloud/servicehub-room/releases{/id}","deployments_url":"https://api.github.com/repos/revaturecloud/servicehub-room/deployments","created_at":"2018-05-01T01:32:45Z","updated_at":"2018-06-07T02:39:21Z","pushed_at":"2018-06-15T21:53:57Z","git_url":"git://github.com/revaturecloud/servicehub-room.git","ssh_url":"git@github.com:revaturecloud/servicehub-room.git","clone_url":"https://github.com/revaturecloud/servicehub-room.git","svn_url":"https://github.com/revaturecloud/servicehub-room","homepage":null,"size":80,"stargazers_count":2,"watchers_count":2,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/20"},"html":{"href":"https://github.com/revaturecloud/servicehub-room/pull/20"},"issue":{"href":"https://api.github.com/repos/revaturecloud/servicehub-room/issues/20"},"comments":{"href":"https://api.github.com/repos/revaturecloud/servicehub-room/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/revaturecloud/servicehub-room/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/revaturecloud/servicehub-room/statuses/1562189324508dfd100ce16dca608d1dc546374f"}},"author_association":"NONE"}}
{"actor":{"display_login":"escalonn"}}