{"action":"created","comment":{"url":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/comments/98526090","pull_request_review_id":19170400,"id":98526090,"diff_hunk":"@@ -0,0 +1,91 @@\n+﻿using Microsoft.EntityFrameworkCore;\n+using System.Linq;\n+\n+namespace GovITHub.Auth.Common.Data.Impl\n+{\n+    public class OrganizationUserRepository : Contract.IOrganizationUserRepository\n+    {\n+        private readonly ApplicationDbContext dbContext;\n+\n+        public OrganizationUserRepository(ApplicationDbContext dbContext)\n+        {\n+            this.dbContext = dbContext;\n+        }\n+\n+        public ModelQuery<Contract.OrganizationUser> Filter(long organizationId, ModelQueryFilter filter)\n+        {\n+            IQueryable<Models.OrganizationUser> dbOrganizationUsersQuery = dbContext.OrganizationUsers.Where(x => x.OrganizationId == organizationId);\n+\n+            Contract.OrganizationUser[] organizationUsers = dbOrganizationUsersQuery.Include(x => x.User).Select(x =>\n+                new\n+                {\n+                    Id = x.Id,\n+                    Name = x.User.Email,\n+                    Level = x.Level,\n+                    Status = x.Status\n+                }).Apply(filter).ToArray().Select(x => new Contract.OrganizationUser()\n+                {\n+                    Id = x.Id,\n+                    Name = x.Name,\n+                    Level = x.Level,\n+                    Status = x.Status\n+                }).ToArray();\n+\n+            return new ModelQuery<Contract.OrganizationUser>()\n+            {\n+                List = organizationUsers,\n+                TotalItems = dbOrganizationUsersQuery.Count()\n+            };\n+        }\n+\n+        public Contract.OrganizationUser Find(long organizationId, long id)\n+        {\n+            Models.OrganizationUser dbOrganzationUser = dbContext.OrganizationUsers.Where(x => x.OrganizationId == organizationId).Include(x => x.User).FirstOrDefault(t => t.Id == id);\n+\n+            return new Contract.OrganizationUser()\n+            {\n+                Id = dbOrganzationUser.Id,\n+                Name = dbOrganzationUser.User.Email,\n+                Level = dbOrganzationUser.Level,\n+                Status = dbOrganzationUser.Status\n+            };\n+        }\n+\n+        public void Update(Contract.OrganizationUser organizationUser)\n+        {\n+            Common.Models.ApplicationUser applicationUser = dbContext.Users.FirstOrDefault(x => x.Email == organizationUser.Name);\n+\n+            Models.OrganizationUser dbOrganizationUser = dbContext.OrganizationUsers.FirstOrDefault(x => x.OrganizationId == organizationUser.OrganizationId && x.Id == organizationUser.Id);\n+            dbOrganizationUser.Level = organizationUser.Level;\n+            dbOrganizationUser.Status = organizationUser.Status;\n+            dbOrganizationUser.UserId = applicationUser.Id;\n+\n+            dbContext.SaveChanges();\n+        }\n+\n+        public void Add(Contract.OrganizationUser organizationUser)\n+        {\n+            Common.Models.ApplicationUser applicationUser = dbContext.Users.FirstOrDefault(x => x.Email == organizationUser.Name);","path":"src/GovITHub.Auth.Common/Data/Impl/OrganizationUserRepository.cs","position":68,"original_position":68,"commit_id":"6a1103ac839f7d812ad23ecbf24e47f42dc2b6c1","original_commit_id":"6a1103ac839f7d812ad23ecbf24e47f42dc2b6c1","user":{"login":"aoancea","id":4282532,"avatar_url":"https://avatars.githubusercontent.com/u/4282532?v=3","gravatar_id":"","url":"https://api.github.com/users/aoancea","html_url":"https://github.com/aoancea","followers_url":"https://api.github.com/users/aoancea/followers","following_url":"https://api.github.com/users/aoancea/following{/other_user}","gists_url":"https://api.github.com/users/aoancea/gists{/gist_id}","starred_url":"https://api.github.com/users/aoancea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoancea/subscriptions","organizations_url":"https://api.github.com/users/aoancea/orgs","repos_url":"https://api.github.com/users/aoancea/repos","events_url":"https://api.github.com/users/aoancea/events{/privacy}","received_events_url":"https://api.github.com/users/aoancea/received_events","type":"User","site_admin":false},"body":"Am adaugat #113","created_at":"2017-01-30T19:53:17Z","updated_at":"2017-01-30T19:53:17Z","html_url":"https://github.com/gov-ithub/auth-sso/pull/107#discussion_r98526090","pull_request_url":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/107","_links":{"self":{"href":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/comments/98526090"},"html":{"href":"https://github.com/gov-ithub/auth-sso/pull/107#discussion_r98526090"},"pull_request":{"href":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/107"}}},"pull_request":{"url":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/107","id":101939101,"html_url":"https://github.com/gov-ithub/auth-sso/pull/107","diff_url":"https://github.com/gov-ithub/auth-sso/pull/107.diff","patch_url":"https://github.com/gov-ithub/auth-sso/pull/107.patch","issue_url":"https://api.github.com/repos/gov-ithub/auth-sso/issues/107","number":107,"state":"open","locked":false,"title":"[WIP]feat(organization-users): prototype CRUD Users - #52","user":{"login":"aoancea","id":4282532,"avatar_url":"https://avatars.githubusercontent.com/u/4282532?v=3","gravatar_id":"","url":"https://api.github.com/users/aoancea","html_url":"https://github.com/aoancea","followers_url":"https://api.github.com/users/aoancea/followers","following_url":"https://api.github.com/users/aoancea/following{/other_user}","gists_url":"https://api.github.com/users/aoancea/gists{/gist_id}","starred_url":"https://api.github.com/users/aoancea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoancea/subscriptions","organizations_url":"https://api.github.com/users/aoancea/orgs","repos_url":"https://api.github.com/users/aoancea/repos","events_url":"https://api.github.com/users/aoancea/events{/privacy}","received_events_url":"https://api.github.com/users/aoancea/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-01-17T20:20:41Z","updated_at":"2017-01-30T19:53:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9159ee46384ff032821f27fa82724be03bfd8271","assignee":{"login":"aoancea","id":4282532,"avatar_url":"https://avatars.githubusercontent.com/u/4282532?v=3","gravatar_id":"","url":"https://api.github.com/users/aoancea","html_url":"https://github.com/aoancea","followers_url":"https://api.github.com/users/aoancea/followers","following_url":"https://api.github.com/users/aoancea/following{/other_user}","gists_url":"https://api.github.com/users/aoancea/gists{/gist_id}","starred_url":"https://api.github.com/users/aoancea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoancea/subscriptions","organizations_url":"https://api.github.com/users/aoancea/orgs","repos_url":"https://api.github.com/users/aoancea/repos","events_url":"https://api.github.com/users/aoancea/events{/privacy}","received_events_url":"https://api.github.com/users/aoancea/received_events","type":"User","site_admin":false},"assignees":[{"login":"aoancea","id":4282532,"avatar_url":"https://avatars.githubusercontent.com/u/4282532?v=3","gravatar_id":"","url":"https://api.github.com/users/aoancea","html_url":"https://github.com/aoancea","followers_url":"https://api.github.com/users/aoancea/followers","following_url":"https://api.github.com/users/aoancea/following{/other_user}","gists_url":"https://api.github.com/users/aoancea/gists{/gist_id}","starred_url":"https://api.github.com/users/aoancea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoancea/subscriptions","organizations_url":"https://api.github.com/users/aoancea/orgs","repos_url":"https://api.github.com/users/aoancea/repos","events_url":"https://api.github.com/users/aoancea/events{/privacy}","received_events_url":"https://api.github.com/users/aoancea/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/107/commits","review_comments_url":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/107/comments","review_comment_url":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gov-ithub/auth-sso/issues/107/comments","statuses_url":"https://api.github.com/repos/gov-ithub/auth-sso/statuses/6a1103ac839f7d812ad23ecbf24e47f42dc2b6c1","head":{"label":"aoancea:i52-impl","ref":"i52-impl","sha":"6a1103ac839f7d812ad23ecbf24e47f42dc2b6c1","user":{"login":"aoancea","id":4282532,"avatar_url":"https://avatars.githubusercontent.com/u/4282532?v=3","gravatar_id":"","url":"https://api.github.com/users/aoancea","html_url":"https://github.com/aoancea","followers_url":"https://api.github.com/users/aoancea/followers","following_url":"https://api.github.com/users/aoancea/following{/other_user}","gists_url":"https://api.github.com/users/aoancea/gists{/gist_id}","starred_url":"https://api.github.com/users/aoancea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoancea/subscriptions","organizations_url":"https://api.github.com/users/aoancea/orgs","repos_url":"https://api.github.com/users/aoancea/repos","events_url":"https://api.github.com/users/aoancea/events{/privacy}","received_events_url":"https://api.github.com/users/aoancea/received_events","type":"User","site_admin":false},"repo":{"id":74787754,"name":"auth-sso","full_name":"aoancea/auth-sso","owner":{"login":"aoancea","id":4282532,"avatar_url":"https://avatars.githubusercontent.com/u/4282532?v=3","gravatar_id":"","url":"https://api.github.com/users/aoancea","html_url":"https://github.com/aoancea","followers_url":"https://api.github.com/users/aoancea/followers","following_url":"https://api.github.com/users/aoancea/following{/other_user}","gists_url":"https://api.github.com/users/aoancea/gists{/gist_id}","starred_url":"https://api.github.com/users/aoancea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoancea/subscriptions","organizations_url":"https://api.github.com/users/aoancea/orgs","repos_url":"https://api.github.com/users/aoancea/repos","events_url":"https://api.github.com/users/aoancea/events{/privacy}","received_events_url":"https://api.github.com/users/aoancea/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aoancea/auth-sso","description":"Citizen Single Sign On (SSO) ","fork":true,"url":"https://api.github.com/repos/aoancea/auth-sso","forks_url":"https://api.github.com/repos/aoancea/auth-sso/forks","keys_url":"https://api.github.com/repos/aoancea/auth-sso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aoancea/auth-sso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aoancea/auth-sso/teams","hooks_url":"https://api.github.com/repos/aoancea/auth-sso/hooks","issue_events_url":"https://api.github.com/repos/aoancea/auth-sso/issues/events{/number}","events_url":"https://api.github.com/repos/aoancea/auth-sso/events","assignees_url":"https://api.github.com/repos/aoancea/auth-sso/assignees{/user}","branches_url":"https://api.github.com/repos/aoancea/auth-sso/branches{/branch}","tags_url":"https://api.github.com/repos/aoancea/auth-sso/tags","blobs_url":"https://api.github.com/repos/aoancea/auth-sso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aoancea/auth-sso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aoancea/auth-sso/git/refs{/sha}","trees_url":"https://api.github.com/repos/aoancea/auth-sso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aoancea/auth-sso/statuses/{sha}","languages_url":"https://api.github.com/repos/aoancea/auth-sso/languages","stargazers_url":"https://api.github.com/repos/aoancea/auth-sso/stargazers","contributors_url":"https://api.github.com/repos/aoancea/auth-sso/contributors","subscribers_url":"https://api.github.com/repos/aoancea/auth-sso/subscribers","subscription_url":"https://api.github.com/repos/aoancea/auth-sso/subscription","commits_url":"https://api.github.com/repos/aoancea/auth-sso/commits{/sha}","git_commits_url":"https://api.github.com/repos/aoancea/auth-sso/git/commits{/sha}","comments_url":"https://api.github.com/repos/aoancea/auth-sso/comments{/number}","issue_comment_url":"https://api.github.com/repos/aoancea/auth-sso/issues/comments{/number}","contents_url":"https://api.github.com/repos/aoancea/auth-sso/contents/{+path}","compare_url":"https://api.github.com/repos/aoancea/auth-sso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aoancea/auth-sso/merges","archive_url":"https://api.github.com/repos/aoancea/auth-sso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aoancea/auth-sso/downloads","issues_url":"https://api.github.com/repos/aoancea/auth-sso/issues{/number}","pulls_url":"https://api.github.com/repos/aoancea/auth-sso/pulls{/number}","milestones_url":"https://api.github.com/repos/aoancea/auth-sso/milestones{/number}","notifications_url":"https://api.github.com/repos/aoancea/auth-sso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aoancea/auth-sso/labels{/name}","releases_url":"https://api.github.com/repos/aoancea/auth-sso/releases{/id}","deployments_url":"https://api.github.com/repos/aoancea/auth-sso/deployments","created_at":"2016-11-25T20:58:24Z","updated_at":"2016-11-25T20:58:25Z","pushed_at":"2017-01-27T21:57:36Z","git_url":"git://github.com/aoancea/auth-sso.git","ssh_url":"git@github.com:aoancea/auth-sso.git","clone_url":"https://github.com/aoancea/auth-sso.git","svn_url":"https://github.com/aoancea/auth-sso","homepage":"","size":3994,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gov-ithub:master","ref":"master","sha":"12679e12611ed9851ad90100582d4e78f5577256","user":{"login":"gov-ithub","id":22675472,"avatar_url":"https://avatars.githubusercontent.com/u/22675472?v=3","gravatar_id":"","url":"https://api.github.com/users/gov-ithub","html_url":"https://github.com/gov-ithub","followers_url":"https://api.github.com/users/gov-ithub/followers","following_url":"https://api.github.com/users/gov-ithub/following{/other_user}","gists_url":"https://api.github.com/users/gov-ithub/gists{/gist_id}","starred_url":"https://api.github.com/users/gov-ithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gov-ithub/subscriptions","organizations_url":"https://api.github.com/users/gov-ithub/orgs","repos_url":"https://api.github.com/users/gov-ithub/repos","events_url":"https://api.github.com/users/gov-ithub/events{/privacy}","received_events_url":"https://api.github.com/users/gov-ithub/received_events","type":"Organization","site_admin":false},"repo":{"id":71266402,"name":"auth-sso","full_name":"gov-ithub/auth-sso","owner":{"login":"gov-ithub","id":22675472,"avatar_url":"https://avatars.githubusercontent.com/u/22675472?v=3","gravatar_id":"","url":"https://api.github.com/users/gov-ithub","html_url":"https://github.com/gov-ithub","followers_url":"https://api.github.com/users/gov-ithub/followers","following_url":"https://api.github.com/users/gov-ithub/following{/other_user}","gists_url":"https://api.github.com/users/gov-ithub/gists{/gist_id}","starred_url":"https://api.github.com/users/gov-ithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gov-ithub/subscriptions","organizations_url":"https://api.github.com/users/gov-ithub/orgs","repos_url":"https://api.github.com/users/gov-ithub/repos","events_url":"https://api.github.com/users/gov-ithub/events{/privacy}","received_events_url":"https://api.github.com/users/gov-ithub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gov-ithub/auth-sso","description":"Citizen Single Sign On (SSO) ","fork":false,"url":"https://api.github.com/repos/gov-ithub/auth-sso","forks_url":"https://api.github.com/repos/gov-ithub/auth-sso/forks","keys_url":"https://api.github.com/repos/gov-ithub/auth-sso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gov-ithub/auth-sso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gov-ithub/auth-sso/teams","hooks_url":"https://api.github.com/repos/gov-ithub/auth-sso/hooks","issue_events_url":"https://api.github.com/repos/gov-ithub/auth-sso/issues/events{/number}","events_url":"https://api.github.com/repos/gov-ithub/auth-sso/events","assignees_url":"https://api.github.com/repos/gov-ithub/auth-sso/assignees{/user}","branches_url":"https://api.github.com/repos/gov-ithub/auth-sso/branches{/branch}","tags_url":"https://api.github.com/repos/gov-ithub/auth-sso/tags","blobs_url":"https://api.github.com/repos/gov-ithub/auth-sso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gov-ithub/auth-sso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gov-ithub/auth-sso/git/refs{/sha}","trees_url":"https://api.github.com/repos/gov-ithub/auth-sso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gov-ithub/auth-sso/statuses/{sha}","languages_url":"https://api.github.com/repos/gov-ithub/auth-sso/languages","stargazers_url":"https://api.github.com/repos/gov-ithub/auth-sso/stargazers","contributors_url":"https://api.github.com/repos/gov-ithub/auth-sso/contributors","subscribers_url":"https://api.github.com/repos/gov-ithub/auth-sso/subscribers","subscription_url":"https://api.github.com/repos/gov-ithub/auth-sso/subscription","commits_url":"https://api.github.com/repos/gov-ithub/auth-sso/commits{/sha}","git_commits_url":"https://api.github.com/repos/gov-ithub/auth-sso/git/commits{/sha}","comments_url":"https://api.github.com/repos/gov-ithub/auth-sso/comments{/number}","issue_comment_url":"https://api.github.com/repos/gov-ithub/auth-sso/issues/comments{/number}","contents_url":"https://api.github.com/repos/gov-ithub/auth-sso/contents/{+path}","compare_url":"https://api.github.com/repos/gov-ithub/auth-sso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gov-ithub/auth-sso/merges","archive_url":"https://api.github.com/repos/gov-ithub/auth-sso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gov-ithub/auth-sso/downloads","issues_url":"https://api.github.com/repos/gov-ithub/auth-sso/issues{/number}","pulls_url":"https://api.github.com/repos/gov-ithub/auth-sso/pulls{/number}","milestones_url":"https://api.github.com/repos/gov-ithub/auth-sso/milestones{/number}","notifications_url":"https://api.github.com/repos/gov-ithub/auth-sso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gov-ithub/auth-sso/labels{/name}","releases_url":"https://api.github.com/repos/gov-ithub/auth-sso/releases{/id}","deployments_url":"https://api.github.com/repos/gov-ithub/auth-sso/deployments","created_at":"2016-10-18T16:05:31Z","updated_at":"2017-01-23T17:17:08Z","pushed_at":"2017-01-30T15:58:10Z","git_url":"git://github.com/gov-ithub/auth-sso.git","ssh_url":"git@github.com:gov-ithub/auth-sso.git","clone_url":"https://github.com/gov-ithub/auth-sso.git","svn_url":"https://github.com/gov-ithub/auth-sso","homepage":"","size":4001,"stargazers_count":13,"watchers_count":13,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":30,"forks":5,"open_issues":30,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/107"},"html":{"href":"https://github.com/gov-ithub/auth-sso/pull/107"},"issue":{"href":"https://api.github.com/repos/gov-ithub/auth-sso/issues/107"},"comments":{"href":"https://api.github.com/repos/gov-ithub/auth-sso/issues/107/comments"},"review_comments":{"href":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/107/comments"},"review_comment":{"href":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gov-ithub/auth-sso/pulls/107/commits"},"statuses":{"href":"https://api.github.com/repos/gov-ithub/auth-sso/statuses/6a1103ac839f7d812ad23ecbf24e47f42dc2b6c1"}}}}
{"actor":{"display_login":"aoancea"}}