public IHttpActionResult CheckPermissionRole(int permissionId) { try { if (HttpContext.Current.User.Identity.IsAuthenticated) { string userId = HttpContext.Current.User.Identity.GetUserId(); var companyDetail = _companyRepository.GetCompanyDetailByUserId(userId); var rolePermissionDetails = _workFlowRepository.CheckPermissionRole(permissionId, companyDetail.Id); var roleList = rolePermissionDetails.GroupBy(x => new { x.Id, x.RoleName }).ToList(); var roleCollection = new List <RoleAc>(); foreach (var role in roleList) { var roleAc = new RoleAc(); roleAc.Id = role.Key.Id; roleAc.RoleName = role.Key.RoleName; roleCollection.Add(roleAc); } return(Ok(roleCollection)); } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }