Beispiel #1
0
        public async Task <IActionResult> GetUserInvitationByUserId(int userId)
        {
            if (userId == 0)
            {
                userId = Convert.ToInt32(HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier));
            }

            if (!HttpContext.User.IsInRole("admin") && !_getAccessUser.UserCookieIs(HttpContext, Convert.ToString(userId)))
            {
                return(StatusCode(403, "Access Denied !"));
            }

            IEnumerable <ProjectInvitationData> result = await _projectGateway.GetUserInvitationByUserId(userId);

            if (result == null)
            {
                return(BadRequest("User has not invitation project"));
            }

            return(Ok(result));
        }