public async Task <IActionResult> AddAndEditDepartment(DepartmentCustom 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 DepartmentDAL busines layer CommonResponse response = new CommonResponse(); response = departmentMaster.AddAndEditDepartment(data, userId); return(Ok(response)); }