public async Task <IActionResult> CreateAllianceRequest([FromBody] RelationshipRequest relationship) { if ((await _authorizationService.AuthorizeAsync(User, relationship.RequestorId, HttpContext.ScopeItems(ClaimScope.Group))).Succeeded || (await _authorizationService.AuthorizeAsync(User, relationship.AcceptorId, HttpContext.ScopeItems(ClaimScope.Group))).Succeeded) { var request = relationship.ToRelationshipModel(); _relationshipCoreController.CreateRequest(relationship.ToRelationshipModel(), relationship.AutoAccept); var relationshipContract = request.ToContract(); return(new ObjectResult(relationshipContract)); } return(Forbid()); }
public async Task <IActionResult> RemoveAlliance([FromBody] RelationshipStatusUpdate relationship) { if ((await _authorizationService.AuthorizeAsync(User, relationship.RequestorId, HttpContext.ScopeItems(ClaimScope.Group))).Succeeded || (await _authorizationService.AuthorizeAsync(User, relationship.AcceptorId, HttpContext.ScopeItems(ClaimScope.Group))).Succeeded) { var relation = new RelationshipRequest { RequestorId = relationship.RequestorId, AcceptorId = relationship.AcceptorId }; _relationshipCoreController.Delete(relation.ToRelationshipModel()); return(Ok()); } return(Forbid()); }