public async Task <IActionResult> Approve(string organizationId, string id) { if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(organizationId)) { ModelState.AddModelError("Approve", "Access or Organization Id not passed"); return(BadRequest(ModelState)); } Guid entityId = new Guid(id); var orgmem = _manager.GetOrganizationMember(Guid.Parse(organizationId), SecurityContext.PersonId)?.Items?.FirstOrDefault(); if (orgmem == null || (orgmem != null && orgmem.IsAdministrator == null) || (orgmem != null && orgmem.IsAdministrator.HasValue && orgmem.IsAdministrator == false)) { ModelState.AddModelError("Approve", "Approve failed, administrator of an organization can only Approve"); return(BadRequest(ModelState)); } Guid approvalRequestGuid = Guid.Parse(id); try { _manager.ApproveAccessRequest(approvalRequestGuid, SecurityContext); return(Ok()); } catch (Exception ex) { return(ex.GetActionResult()); } }