{"action":"created","comment":{"url":"https://api.github.com/repos/Promact/trappist/pulls/comments/108643626","pull_request_review_id":29685951,"id":108643626,"diff_hunk":"@@ -26,44 +27,49 @@ public CategoryController(ICategoryRepository categoryRepository)\n \n         [HttpPost]\n         /// <summary>\n-        /// Post Method \n-        /// Will Add a Catagory Name in Category Model\n+        /// Method to Add Category\n         ///</summary>\n-        /// <param name=\"category\">Object of  class Category</param>\n-        /// <returns>object of the class </returns>\n-        public IActionResult CatagoryAdd([FromBody] Category category)\n+        /// <param name=\"category\">category object contains category details</param>\n+        /// <returns>category object contains category details</returns>\n+        public async Task<IActionResult> AddCategory([FromBody] Category category)\n         {\n             if (!ModelState.IsValid)\n             {\n                 return BadRequest(ModelState);\n             }\n-            _categoryRepository.AddCategory(category);\n+            var isCategoryNameExists = await _categoryRepository.IsCategoryNameExistsAsync(category);\n+            if (isCategoryNameExists)\n+            {\n+                ModelState.AddModelError(\"error\", \"Category Name Already Exists\");\n+                return BadRequest(ModelState);\n+            }\n+            await _categoryRepository.AddCategoryAsync(category);\n             return Ok(category);\n         }\n \n         /// <summary>\n-        /// Put Method\n-        /// Will Edit a Existing Category from Category Table\n+        /// Method to Update Existing Category\n         /// </summary>\n-        /// <param name=\"Id\">Id is the primary key of Category Model</param>\n-        /// <param name=\"catagory\">Object of  class Category</param>\n-        /// <returns>object of the class if key found or else it will return Bad request</returns>\n+        /// <param name=\"id\">Take from Route whose Property to be Update</param>\n+        /// <param name=\"category\">category object contains category details</param>\n+        /// <returns>Updated category object contains category details</returns>\n         [HttpPut(\"{id}\")]\n-        public IActionResult CategoryEdit(int Id, [FromBody] Category category)\n+        public async Task<IActionResult> UpdateCategory([FromRoute] int id, [FromBody] Category category)\n         {\n             if (!ModelState.IsValid)\n             {\n                 return BadRequest(ModelState);\n             }\n-            var previousCategory = _categoryRepository.GetCategory(Id);\n-            if (previousCategory == null)\n+            var isCategoryNameExists = await _categoryRepository.IsCategoryNameExistsAsync(category);","path":"Trappist/src/Promact.Trappist.Core/Controllers/CategoryController.cs","position":59,"original_position":59,"commit_id":"e5f1fc93a3a88f25b9c4e0393cbc677cffa5a777","original_commit_id":"e5f1fc93a3a88f25b9c4e0393cbc677cffa5a777","user":{"login":"Krunal-Promact","id":18115839,"avatar_url":"https://avatars0.githubusercontent.com/u/18115839?v=3","gravatar_id":"","url":"https://api.github.com/users/Krunal-Promact","html_url":"https://github.com/Krunal-Promact","followers_url":"https://api.github.com/users/Krunal-Promact/followers","following_url":"https://api.github.com/users/Krunal-Promact/following{/other_user}","gists_url":"https://api.github.com/users/Krunal-Promact/gists{/gist_id}","starred_url":"https://api.github.com/users/Krunal-Promact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Krunal-Promact/subscriptions","organizations_url":"https://api.github.com/users/Krunal-Promact/orgs","repos_url":"https://api.github.com/users/Krunal-Promact/repos","events_url":"https://api.github.com/users/Krunal-Promact/events{/privacy}","received_events_url":"https://api.github.com/users/Krunal-Promact/received_events","type":"User","site_admin":false},"body":"you can directly write code in if condition. no need to take extra variable","created_at":"2017-03-29T10:34:36Z","updated_at":"2017-03-29T10:58:42Z","html_url":"https://github.com/Promact/trappist/pull/148#discussion_r108643626","pull_request_url":"https://api.github.com/repos/Promact/trappist/pulls/148","_links":{"self":{"href":"https://api.github.com/repos/Promact/trappist/pulls/comments/108643626"},"html":{"href":"https://github.com/Promact/trappist/pull/148#discussion_r108643626"},"pull_request":{"href":"https://api.github.com/repos/Promact/trappist/pulls/148"}}},"pull_request":{"url":"https://api.github.com/repos/Promact/trappist/pulls/148","id":112583230,"html_url":"https://github.com/Promact/trappist/pull/148","diff_url":"https://github.com/Promact/trappist/pull/148.diff","patch_url":"https://github.com/Promact/trappist/pull/148.patch","issue_url":"https://api.github.com/repos/Promact/trappist/issues/148","number":148,"state":"open","locked":false,"title":"Category Management Client Side Api","user":{"login":"spartha1995","id":25680039,"avatar_url":"https://avatars2.githubusercontent.com/u/25680039?v=3","gravatar_id":"","url":"https://api.github.com/users/spartha1995","html_url":"https://github.com/spartha1995","followers_url":"https://api.github.com/users/spartha1995/followers","following_url":"https://api.github.com/users/spartha1995/following{/other_user}","gists_url":"https://api.github.com/users/spartha1995/gists{/gist_id}","starred_url":"https://api.github.com/users/spartha1995/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spartha1995/subscriptions","organizations_url":"https://api.github.com/users/spartha1995/orgs","repos_url":"https://api.github.com/users/spartha1995/repos","events_url":"https://api.github.com/users/spartha1995/events{/privacy}","received_events_url":"https://api.github.com/users/spartha1995/received_events","type":"User","site_admin":false},"body":"Fixed Issues\r\n#20907,#20910\r\nDesign Rename- dialog-component\r\n\r\nFiles Changed\r\nCategoryController.cs:Method Added CheckDuplicateCategoryNameAsync()\r\nCategory.cs: Maxlength Changed to 150\r\nCategoryRepository.cs:Method Added CheckDuplicateCategoryNameAsync() and and method name changed\r\nICategoryRepository.cs : Method Added CheckDuplicateCategoryNameAsync() and method name changed\r\nCategoryRepositoryTest.cs:Method Name Updated, Add unit test for GetCategoryById and CheckDuplicateCategoryName\r\ncategories.service.ts:addCategory updateCategory Method Added\r\nadd-category-dialog.html : Added Data binding and bind button with function\r\nquestions-dashboard.component.ts : Rename- dialog-component added\r\nquestions-dashboard.html:Added Data binding\r\nrename-category-dialog.component.ts: updateCategory Method Added\r\nrename-category-dialog.html: Added Data binding and bind button with function\r\n\r\n**Checks**\r\n- [x] Naming Conventions\r\n- [x] Server side code comments (proper English, grammar, and no spelling mistakes)\r\n- [x] Client side code comments (proper English, grammar, and no spelling mistakes)\r\n- [x] Unused variables, methods, blank spaces and namespaces. \r\n- [x] Optimal Code and code formatting\r\n- [x] Commit History is proper, no merge is done. \r\n- [x] Commit/pull request messages should be proper to justify your feature\r\n- [x] All test cases are executed provided by tester.\r\n","created_at":"2017-03-25T11:26:02Z","updated_at":"2017-03-29T10:58:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e32f57b36481a098509d1cdaa212681f2a97854c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Promact/trappist/pulls/148/commits","review_comments_url":"https://api.github.com/repos/Promact/trappist/pulls/148/comments","review_comment_url":"https://api.github.com/repos/Promact/trappist/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Promact/trappist/issues/148/comments","statuses_url":"https://api.github.com/repos/Promact/trappist/statuses/e5f1fc93a3a88f25b9c4e0393cbc677cffa5a777","head":{"label":"Promact:category-management-clientside-api","ref":"category-management-clientside-api","sha":"e5f1fc93a3a88f25b9c4e0393cbc677cffa5a777","user":{"login":"Promact","id":7643214,"avatar_url":"https://avatars3.githubusercontent.com/u/7643214?v=3","gravatar_id":"","url":"https://api.github.com/users/Promact","html_url":"https://github.com/Promact","followers_url":"https://api.github.com/users/Promact/followers","following_url":"https://api.github.com/users/Promact/following{/other_user}","gists_url":"https://api.github.com/users/Promact/gists{/gist_id}","starred_url":"https://api.github.com/users/Promact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Promact/subscriptions","organizations_url":"https://api.github.com/users/Promact/orgs","repos_url":"https://api.github.com/users/Promact/repos","events_url":"https://api.github.com/users/Promact/events{/privacy}","received_events_url":"https://api.github.com/users/Promact/received_events","type":"Organization","site_admin":false},"repo":{"id":83275947,"name":"trappist","full_name":"Promact/trappist","owner":{"login":"Promact","id":7643214,"avatar_url":"https://avatars3.githubusercontent.com/u/7643214?v=3","gravatar_id":"","url":"https://api.github.com/users/Promact","html_url":"https://github.com/Promact","followers_url":"https://api.github.com/users/Promact/followers","following_url":"https://api.github.com/users/Promact/following{/other_user}","gists_url":"https://api.github.com/users/Promact/gists{/gist_id}","starred_url":"https://api.github.com/users/Promact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Promact/subscriptions","organizations_url":"https://api.github.com/users/Promact/orgs","repos_url":"https://api.github.com/users/Promact/repos","events_url":"https://api.github.com/users/Promact/events{/privacy}","received_events_url":"https://api.github.com/users/Promact/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Promact/trappist","description":"Trappist is a system which can be used for conducting online tests in colleges, schools & organizations.","fork":false,"url":"https://api.github.com/repos/Promact/trappist","forks_url":"https://api.github.com/repos/Promact/trappist/forks","keys_url":"https://api.github.com/repos/Promact/trappist/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Promact/trappist/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Promact/trappist/teams","hooks_url":"https://api.github.com/repos/Promact/trappist/hooks","issue_events_url":"https://api.github.com/repos/Promact/trappist/issues/events{/number}","events_url":"https://api.github.com/repos/Promact/trappist/events","assignees_url":"https://api.github.com/repos/Promact/trappist/assignees{/user}","branches_url":"https://api.github.com/repos/Promact/trappist/branches{/branch}","tags_url":"https://api.github.com/repos/Promact/trappist/tags","blobs_url":"https://api.github.com/repos/Promact/trappist/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Promact/trappist/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Promact/trappist/git/refs{/sha}","trees_url":"https://api.github.com/repos/Promact/trappist/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Promact/trappist/statuses/{sha}","languages_url":"https://api.github.com/repos/Promact/trappist/languages","stargazers_url":"https://api.github.com/repos/Promact/trappist/stargazers","contributors_url":"https://api.github.com/repos/Promact/trappist/contributors","subscribers_url":"https://api.github.com/repos/Promact/trappist/subscribers","subscription_url":"https://api.github.com/repos/Promact/trappist/subscription","commits_url":"https://api.github.com/repos/Promact/trappist/commits{/sha}","git_commits_url":"https://api.github.com/repos/Promact/trappist/git/commits{/sha}","comments_url":"https://api.github.com/repos/Promact/trappist/comments{/number}","issue_comment_url":"https://api.github.com/repos/Promact/trappist/issues/comments{/number}","contents_url":"https://api.github.com/repos/Promact/trappist/contents/{+path}","compare_url":"https://api.github.com/repos/Promact/trappist/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Promact/trappist/merges","archive_url":"https://api.github.com/repos/Promact/trappist/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Promact/trappist/downloads","issues_url":"https://api.github.com/repos/Promact/trappist/issues{/number}","pulls_url":"https://api.github.com/repos/Promact/trappist/pulls{/number}","milestones_url":"https://api.github.com/repos/Promact/trappist/milestones{/number}","notifications_url":"https://api.github.com/repos/Promact/trappist/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Promact/trappist/labels{/name}","releases_url":"https://api.github.com/repos/Promact/trappist/releases{/id}","deployments_url":"https://api.github.com/repos/Promact/trappist/deployments","created_at":"2017-02-27T06:26:25Z","updated_at":"2017-03-24T08:50:53Z","pushed_at":"2017-03-29T10:55:17Z","git_url":"git://github.com/Promact/trappist.git","ssh_url":"git@github.com:Promact/trappist.git","clone_url":"https://github.com/Promact/trappist.git","svn_url":"https://github.com/Promact/trappist","homepage":null,"size":1437,"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,"open_issues_count":12,"forks":2,"open_issues":12,"watchers":2,"default_branch":"master"}},"base":{"label":"Promact:development","ref":"development","sha":"16702d257252d021f50d37d2e5dbcabdd2d53d6a","user":{"login":"Promact","id":7643214,"avatar_url":"https://avatars3.githubusercontent.com/u/7643214?v=3","gravatar_id":"","url":"https://api.github.com/users/Promact","html_url":"https://github.com/Promact","followers_url":"https://api.github.com/users/Promact/followers","following_url":"https://api.github.com/users/Promact/following{/other_user}","gists_url":"https://api.github.com/users/Promact/gists{/gist_id}","starred_url":"https://api.github.com/users/Promact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Promact/subscriptions","organizations_url":"https://api.github.com/users/Promact/orgs","repos_url":"https://api.github.com/users/Promact/repos","events_url":"https://api.github.com/users/Promact/events{/privacy}","received_events_url":"https://api.github.com/users/Promact/received_events","type":"Organization","site_admin":false},"repo":{"id":83275947,"name":"trappist","full_name":"Promact/trappist","owner":{"login":"Promact","id":7643214,"avatar_url":"https://avatars3.githubusercontent.com/u/7643214?v=3","gravatar_id":"","url":"https://api.github.com/users/Promact","html_url":"https://github.com/Promact","followers_url":"https://api.github.com/users/Promact/followers","following_url":"https://api.github.com/users/Promact/following{/other_user}","gists_url":"https://api.github.com/users/Promact/gists{/gist_id}","starred_url":"https://api.github.com/users/Promact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Promact/subscriptions","organizations_url":"https://api.github.com/users/Promact/orgs","repos_url":"https://api.github.com/users/Promact/repos","events_url":"https://api.github.com/users/Promact/events{/privacy}","received_events_url":"https://api.github.com/users/Promact/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Promact/trappist","description":"Trappist is a system which can be used for conducting online tests in colleges, schools & organizations.","fork":false,"url":"https://api.github.com/repos/Promact/trappist","forks_url":"https://api.github.com/repos/Promact/trappist/forks","keys_url":"https://api.github.com/repos/Promact/trappist/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Promact/trappist/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Promact/trappist/teams","hooks_url":"https://api.github.com/repos/Promact/trappist/hooks","issue_events_url":"https://api.github.com/repos/Promact/trappist/issues/events{/number}","events_url":"https://api.github.com/repos/Promact/trappist/events","assignees_url":"https://api.github.com/repos/Promact/trappist/assignees{/user}","branches_url":"https://api.github.com/repos/Promact/trappist/branches{/branch}","tags_url":"https://api.github.com/repos/Promact/trappist/tags","blobs_url":"https://api.github.com/repos/Promact/trappist/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Promact/trappist/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Promact/trappist/git/refs{/sha}","trees_url":"https://api.github.com/repos/Promact/trappist/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Promact/trappist/statuses/{sha}","languages_url":"https://api.github.com/repos/Promact/trappist/languages","stargazers_url":"https://api.github.com/repos/Promact/trappist/stargazers","contributors_url":"https://api.github.com/repos/Promact/trappist/contributors","subscribers_url":"https://api.github.com/repos/Promact/trappist/subscribers","subscription_url":"https://api.github.com/repos/Promact/trappist/subscription","commits_url":"https://api.github.com/repos/Promact/trappist/commits{/sha}","git_commits_url":"https://api.github.com/repos/Promact/trappist/git/commits{/sha}","comments_url":"https://api.github.com/repos/Promact/trappist/comments{/number}","issue_comment_url":"https://api.github.com/repos/Promact/trappist/issues/comments{/number}","contents_url":"https://api.github.com/repos/Promact/trappist/contents/{+path}","compare_url":"https://api.github.com/repos/Promact/trappist/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Promact/trappist/merges","archive_url":"https://api.github.com/repos/Promact/trappist/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Promact/trappist/downloads","issues_url":"https://api.github.com/repos/Promact/trappist/issues{/number}","pulls_url":"https://api.github.com/repos/Promact/trappist/pulls{/number}","milestones_url":"https://api.github.com/repos/Promact/trappist/milestones{/number}","notifications_url":"https://api.github.com/repos/Promact/trappist/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Promact/trappist/labels{/name}","releases_url":"https://api.github.com/repos/Promact/trappist/releases{/id}","deployments_url":"https://api.github.com/repos/Promact/trappist/deployments","created_at":"2017-02-27T06:26:25Z","updated_at":"2017-03-24T08:50:53Z","pushed_at":"2017-03-29T10:55:17Z","git_url":"git://github.com/Promact/trappist.git","ssh_url":"git@github.com:Promact/trappist.git","clone_url":"https://github.com/Promact/trappist.git","svn_url":"https://github.com/Promact/trappist","homepage":null,"size":1437,"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,"open_issues_count":12,"forks":2,"open_issues":12,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Promact/trappist/pulls/148"},"html":{"href":"https://github.com/Promact/trappist/pull/148"},"issue":{"href":"https://api.github.com/repos/Promact/trappist/issues/148"},"comments":{"href":"https://api.github.com/repos/Promact/trappist/issues/148/comments"},"review_comments":{"href":"https://api.github.com/repos/Promact/trappist/pulls/148/comments"},"review_comment":{"href":"https://api.github.com/repos/Promact/trappist/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Promact/trappist/pulls/148/commits"},"statuses":{"href":"https://api.github.com/repos/Promact/trappist/statuses/e5f1fc93a3a88f25b9c4e0393cbc677cffa5a777"}}}}
{"actor":{"display_login":"Krunal-Promact"}}