Example #1
0
 public IHttpActionResult ApproveDenyGroupInvitation([FromUri] int groupId, [FromUri] string invitationKey, [FromBody] bool accept)
 {
     return(Authorized(token =>
     {
         try
         {
             _finderService.AcceptDenyGroupInvitation(token, groupId, invitationKey, accept);
             return Ok();
         }
         catch (GroupParticipantRemovalException)
         {
             throw new HttpResponseException(HttpStatusCode.NotAcceptable);
         }
         catch (DuplicateGroupParticipantException)
         {
             throw new HttpResponseException(HttpStatusCode.Conflict);
         }
         catch (Exception ex)
         {
             var apiError = new ApiErrorDto($"Error when accepting: {accept}, for group {groupId}", ex);
             throw new HttpResponseException(apiError.HttpResponseMessage);
         }
     }));
 }