public async Task <IActionResult> AddAndEditRole(RoleCustom data) { #region Authorization code var identity = HttpContext.User.Identity as ClaimsIdentity; string id = ""; string role = ""; if (identity != null) { IEnumerable <Claim> claims = identity.Claims; // or id = identity.Claims.Where(m => m.Type == ClaimTypes.Sid).Select(m => m.Value).FirstOrDefault(); role = identity.Claims.Where(m => m.Type == ClaimTypes.Role).Select(m => m.Value).FirstOrDefault(); } long userId = Convert.ToInt32(id); #endregion //calling RoleDAL busines layer CommonResponse response = new CommonResponse(); response = roleMaster.AddAndEditRole(data, userId); return(Ok(response)); }