Exemplo n.º 1
0
        public IHttpActionResult GetPledges()
        {
            return(Authorized(token =>
            {
                try
                {
                    var pledges = _donorService.GetCapitalCampaignPledgesForAuthenticatedUser(token);

                    if (pledges == null || !pledges.Any())
                    {
                        return (RestHttpActionResult <ApiErrorDto> .WithStatus(HttpStatusCode.NotFound, new ApiErrorDto("No matching commitments found")));
                    }

                    return (Ok(pledges));
                }
                catch (UserImpersonationException e)
                {
                    return (e.GetRestHttpActionResult());
                }
            }));
        }