Example #1
0
 public IHttpActionResult GatheringJoinRequest([FromBody] int gatheringId)
 {
     return(Authorized(token =>
     {
         try
         {
             _finderService.GatheringJoinRequest(token, gatheringId);
             return (Ok());
         }
         catch (Exception e)
         {
             _logger.Error("Could not generate request", e);
             if (e.Message == "User already has request")
             {
                 throw new HttpResponseException(HttpStatusCode.Conflict);
             }
             else if (e.Message == "User already a member")
             {
                 throw new HttpResponseException(HttpStatusCode.NotAcceptable);
             }
             else
             {
                 throw new HttpResponseException(new ApiErrorDto("Gathering request failed", e).HttpResponseMessage);
             }
         }
     }));
 }