{"action":"created","comment":{"url":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/comments/166647773","pull_request_review_id":94744039,"id":166647773,"diff_hunk":"@@ -0,0 +1,141 @@\n+﻿using System.Collections.Generic;\n+using System.ComponentModel;\n+using System.Linq;\n+using AutoMapper;\n+using GLAA.Domain.Models;\n+using GLAA.Repository;\n+using GLAA.ViewModels.PublicRegister;\n+using Microsoft.AspNetCore.Mvc.Rendering;\n+\n+namespace GLAA.Services.PublicRegister\n+{\n+    public class PublicRegisterViewModelBuilder : IPublicRegisterViewModelBuilder\n+    {\n+        private readonly IEntityFrameworkRepository repository;\n+        private readonly ILicenceRepository licenceRepository;\n+        private readonly IMapper mapper;\n+\n+        private List<SelectListItem> _ukCountries;\n+        public List<SelectListItem> UkCountries => new List<SelectListItem>(_ukCountries);\n+\n+        public PublicRegisterViewModelBuilder(\n+            IMapper mapper,\n+            IEntityFrameworkRepository repository,\n+            ILicenceRepository licenceRepository)\n+        {\n+            this.mapper = mapper;\n+            this.repository = repository;\n+            this.licenceRepository = licenceRepository;\n+\n+            _ukCountries = repository.GetAll<Country>().Select(x =>\n+                new SelectListItem { Value = x.Name, Text = x.Name }).ToList();\n+        }\n+\n+        public PublicRegisterLicenceListViewModel BuildAllLicences()\n+        {\n+            return new PublicRegisterLicenceListViewModel\n+            {\n+                Title = \"Public Register\",\n+                //We only want licences with status that are allowed to be shown using the \"ShowInPublicRegister\" field.\n+                Licences = licenceRepository.GetAllLicences()\n+                    .Where(x => GetLatestStatus(x).Status.ShowInPublicRegister)\n+                    .Select(BuildSummary),\n+                PublicRegisterSearchViewModel = BuildPublicRegisterSearchViewModel()\n+            };\n+        }\n+\n+        public PublicRegisterLicenceListViewModel BuildEmptySearch()\n+        {\n+            return new PublicRegisterLicenceListViewModel\n+            {\n+                Title = \"Public Register\",","path":"GLAA.Services/PublicRegister/PublicRegisterViewModelBuilder.cs","position":51,"original_position":51,"commit_id":"9bdb417ab9de07f62c7b374b81e5a234bfbf18f5","original_commit_id":"9bdb417ab9de07f62c7b374b81e5a234bfbf18f5","user":{"login":"sayerhilton","id":2010565,"avatar_url":"https://avatars3.githubusercontent.com/u/2010565?v=4","gravatar_id":"","url":"https://api.github.com/users/sayerhilton","html_url":"https://github.com/sayerhilton","followers_url":"https://api.github.com/users/sayerhilton/followers","following_url":"https://api.github.com/users/sayerhilton/following{/other_user}","gists_url":"https://api.github.com/users/sayerhilton/gists{/gist_id}","starred_url":"https://api.github.com/users/sayerhilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sayerhilton/subscriptions","organizations_url":"https://api.github.com/users/sayerhilton/orgs","repos_url":"https://api.github.com/users/sayerhilton/repos","events_url":"https://api.github.com/users/sayerhilton/events{/privacy}","received_events_url":"https://api.github.com/users/sayerhilton/received_events","type":"User","site_admin":false},"body":"Title removed.","created_at":"2018-02-07T15:14:04Z","updated_at":"2018-02-07T15:14:04Z","html_url":"https://github.com/UKHomeOffice/glaa-web/pull/111#discussion_r166647773","pull_request_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/111","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/comments/166647773"},"html":{"href":"https://github.com/UKHomeOffice/glaa-web/pull/111#discussion_r166647773"},"pull_request":{"href":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/111"}},"in_reply_to_id":166570000},"pull_request":{"url":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/111","id":167635544,"html_url":"https://github.com/UKHomeOffice/glaa-web/pull/111","diff_url":"https://github.com/UKHomeOffice/glaa-web/pull/111.diff","patch_url":"https://github.com/UKHomeOffice/glaa-web/pull/111.patch","issue_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/issues/111","number":111,"state":"open","locked":false,"title":"Basic public register","user":{"login":"sayerhilton","id":2010565,"avatar_url":"https://avatars3.githubusercontent.com/u/2010565?v=4","gravatar_id":"","url":"https://api.github.com/users/sayerhilton","html_url":"https://github.com/sayerhilton","followers_url":"https://api.github.com/users/sayerhilton/followers","following_url":"https://api.github.com/users/sayerhilton/following{/other_user}","gists_url":"https://api.github.com/users/sayerhilton/gists{/gist_id}","starred_url":"https://api.github.com/users/sayerhilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sayerhilton/subscriptions","organizations_url":"https://api.github.com/users/sayerhilton/orgs","repos_url":"https://api.github.com/users/sayerhilton/repos","events_url":"https://api.github.com/users/sayerhilton/events{/privacy}","received_events_url":"https://api.github.com/users/sayerhilton/received_events","type":"User","site_admin":false},"body":"A basic version of the register. (Screenshot at end).\r\n\r\nCurrently incomplete.  But...\r\n\r\n1. Allows users to search on the criteria provided.\r\n2. Allows users to click on the view icon and browse to another page.\r\n3. The filters for the countries has some logic associated with it to aid the user on the searching criteria.\r\n4. Fully support graceful fallback with no JS.\r\n\r\nThings to note:\r\n\r\n1. Columns are not sortable.\r\n2. No \"lazy loading\".\r\n3. No Auto-complete box for the country search.\r\n4. The \"view\" page needs to be finished.\r\n5. The countries and their naming convention needs to be reviewed.\r\n6. The Licensed state is not currently formatted.\r\n\r\n![publicregister-1](https://user-images.githubusercontent.com/2010565/35907909-25367692-0be7-11e8-8fd3-49a4132150b1.png)\r\n","created_at":"2018-02-07T09:16:53Z","updated_at":"2018-02-07T15:14:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e1e9fa96d4e04ace38afccc06e2033aee4969d4e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/111/commits","review_comments_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/111/comments","review_comment_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/issues/111/comments","statuses_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/statuses/9bdb417ab9de07f62c7b374b81e5a234bfbf18f5","head":{"label":"UKHomeOffice:basic-register","ref":"basic-register","sha":"9bdb417ab9de07f62c7b374b81e5a234bfbf18f5","user":{"login":"UKHomeOffice","id":3778081,"avatar_url":"https://avatars2.githubusercontent.com/u/3778081?v=4","gravatar_id":"","url":"https://api.github.com/users/UKHomeOffice","html_url":"https://github.com/UKHomeOffice","followers_url":"https://api.github.com/users/UKHomeOffice/followers","following_url":"https://api.github.com/users/UKHomeOffice/following{/other_user}","gists_url":"https://api.github.com/users/UKHomeOffice/gists{/gist_id}","starred_url":"https://api.github.com/users/UKHomeOffice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UKHomeOffice/subscriptions","organizations_url":"https://api.github.com/users/UKHomeOffice/orgs","repos_url":"https://api.github.com/users/UKHomeOffice/repos","events_url":"https://api.github.com/users/UKHomeOffice/events{/privacy}","received_events_url":"https://api.github.com/users/UKHomeOffice/received_events","type":"Organization","site_admin":false},"repo":{"id":114993209,"name":"glaa-web","full_name":"UKHomeOffice/glaa-web","owner":{"login":"UKHomeOffice","id":3778081,"avatar_url":"https://avatars2.githubusercontent.com/u/3778081?v=4","gravatar_id":"","url":"https://api.github.com/users/UKHomeOffice","html_url":"https://github.com/UKHomeOffice","followers_url":"https://api.github.com/users/UKHomeOffice/followers","following_url":"https://api.github.com/users/UKHomeOffice/following{/other_user}","gists_url":"https://api.github.com/users/UKHomeOffice/gists{/gist_id}","starred_url":"https://api.github.com/users/UKHomeOffice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UKHomeOffice/subscriptions","organizations_url":"https://api.github.com/users/UKHomeOffice/orgs","repos_url":"https://api.github.com/users/UKHomeOffice/repos","events_url":"https://api.github.com/users/UKHomeOffice/events{/privacy}","received_events_url":"https://api.github.com/users/UKHomeOffice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UKHomeOffice/glaa-web","description":"Gangmasters Labour and Abuse Authority","fork":false,"url":"https://api.github.com/repos/UKHomeOffice/glaa-web","forks_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/forks","keys_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/teams","hooks_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/hooks","issue_events_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/issues/events{/number}","events_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/events","assignees_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/assignees{/user}","branches_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/branches{/branch}","tags_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/tags","blobs_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/statuses/{sha}","languages_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/languages","stargazers_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/stargazers","contributors_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/contributors","subscribers_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/subscribers","subscription_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/subscription","commits_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/contents/{+path}","compare_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/merges","archive_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/downloads","issues_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/issues{/number}","pulls_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls{/number}","milestones_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/milestones{/number}","notifications_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/labels{/name}","releases_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/releases{/id}","deployments_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/deployments","created_at":"2017-12-21T10:24:19Z","updated_at":"2018-01-02T08:40:19Z","pushed_at":"2018-02-07T15:11:53Z","git_url":"git://github.com/UKHomeOffice/glaa-web.git","ssh_url":"git@github.com:UKHomeOffice/glaa-web.git","clone_url":"https://github.com/UKHomeOffice/glaa-web.git","svn_url":"https://github.com/UKHomeOffice/glaa-web","homepage":null,"size":1761,"stargazers_count":0,"watchers_count":0,"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":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"UKHomeOffice:master","ref":"master","sha":"9f03c6350f79c99f287c7f37a1a6d87eb39c9d46","user":{"login":"UKHomeOffice","id":3778081,"avatar_url":"https://avatars2.githubusercontent.com/u/3778081?v=4","gravatar_id":"","url":"https://api.github.com/users/UKHomeOffice","html_url":"https://github.com/UKHomeOffice","followers_url":"https://api.github.com/users/UKHomeOffice/followers","following_url":"https://api.github.com/users/UKHomeOffice/following{/other_user}","gists_url":"https://api.github.com/users/UKHomeOffice/gists{/gist_id}","starred_url":"https://api.github.com/users/UKHomeOffice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UKHomeOffice/subscriptions","organizations_url":"https://api.github.com/users/UKHomeOffice/orgs","repos_url":"https://api.github.com/users/UKHomeOffice/repos","events_url":"https://api.github.com/users/UKHomeOffice/events{/privacy}","received_events_url":"https://api.github.com/users/UKHomeOffice/received_events","type":"Organization","site_admin":false},"repo":{"id":114993209,"name":"glaa-web","full_name":"UKHomeOffice/glaa-web","owner":{"login":"UKHomeOffice","id":3778081,"avatar_url":"https://avatars2.githubusercontent.com/u/3778081?v=4","gravatar_id":"","url":"https://api.github.com/users/UKHomeOffice","html_url":"https://github.com/UKHomeOffice","followers_url":"https://api.github.com/users/UKHomeOffice/followers","following_url":"https://api.github.com/users/UKHomeOffice/following{/other_user}","gists_url":"https://api.github.com/users/UKHomeOffice/gists{/gist_id}","starred_url":"https://api.github.com/users/UKHomeOffice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UKHomeOffice/subscriptions","organizations_url":"https://api.github.com/users/UKHomeOffice/orgs","repos_url":"https://api.github.com/users/UKHomeOffice/repos","events_url":"https://api.github.com/users/UKHomeOffice/events{/privacy}","received_events_url":"https://api.github.com/users/UKHomeOffice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UKHomeOffice/glaa-web","description":"Gangmasters Labour and Abuse Authority","fork":false,"url":"https://api.github.com/repos/UKHomeOffice/glaa-web","forks_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/forks","keys_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/teams","hooks_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/hooks","issue_events_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/issues/events{/number}","events_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/events","assignees_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/assignees{/user}","branches_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/branches{/branch}","tags_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/tags","blobs_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/statuses/{sha}","languages_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/languages","stargazers_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/stargazers","contributors_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/contributors","subscribers_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/subscribers","subscription_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/subscription","commits_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/contents/{+path}","compare_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/merges","archive_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/downloads","issues_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/issues{/number}","pulls_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls{/number}","milestones_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/milestones{/number}","notifications_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/labels{/name}","releases_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/releases{/id}","deployments_url":"https://api.github.com/repos/UKHomeOffice/glaa-web/deployments","created_at":"2017-12-21T10:24:19Z","updated_at":"2018-01-02T08:40:19Z","pushed_at":"2018-02-07T15:11:53Z","git_url":"git://github.com/UKHomeOffice/glaa-web.git","ssh_url":"git@github.com:UKHomeOffice/glaa-web.git","clone_url":"https://github.com/UKHomeOffice/glaa-web.git","svn_url":"https://github.com/UKHomeOffice/glaa-web","homepage":null,"size":1761,"stargazers_count":0,"watchers_count":0,"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":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/111"},"html":{"href":"https://github.com/UKHomeOffice/glaa-web/pull/111"},"issue":{"href":"https://api.github.com/repos/UKHomeOffice/glaa-web/issues/111"},"comments":{"href":"https://api.github.com/repos/UKHomeOffice/glaa-web/issues/111/comments"},"review_comments":{"href":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/111/comments"},"review_comment":{"href":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UKHomeOffice/glaa-web/pulls/111/commits"},"statuses":{"href":"https://api.github.com/repos/UKHomeOffice/glaa-web/statuses/9bdb417ab9de07f62c7b374b81e5a234bfbf18f5"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"sayerhilton"}}