Example #1
0
        public IHttpActionResult TryAGroupAccept([FromUri] int groupId, [FromUri] int participantId)
        {
            return(Authorized(token =>
            {
                try
                {
                    _finderService.TryAGroupAcceptDeny(token, groupId, participantId, true);
                    return Ok();
                }
                catch (Exception e)
                {
                    _logger.Error("Could not accept request", e);
                    switch (e.Message)
                    {
                    case "User is already a group member":
                        throw new HttpResponseException(HttpStatusCode.Conflict);

                    default:
                        throw new HttpResponseException(new ApiErrorDto("Try a group accept request failed", e).HttpResponseMessage);
                    }
                }
            }));
        }