Example #1
0
        public IHttpActionResult EditGatheringPin([FromBody] PinDto pin)
        {
            return(Authorized(token =>
            {
                try
                {
                    if (pin.Contact_ID != _authenticationRepo.GetContactId(token))
                    {
                        throw new HttpResponseException(HttpStatusCode.Unauthorized);
                    }

                    pin = _finderService.UpdateGathering(pin);
                    _awsCloudsearchService.UploadNewPinToAws(pin);

                    return (Ok(pin));
                }
                catch (Exception e)
                {
                    _logger.Error("Could not update pin", e);
                    var apiError = new ApiErrorDto("Save Pin Failed", e);
                    throw new HttpResponseException(apiError.HttpResponseMessage);
                }
            }));
        }