Ejemplo n.º 1
0
        public async Task <IActionResult> PutOffer(ulong id, UpdateOfferDto updateOfferDto)
        {
            try
            {
                OfferDto offerDto = await _business.UpdateOffer(id, UserId, updateOfferDto);

                if (offerDto == null)
                {
                    return(NotFound($"An offer with id \"{id}\" was not found."));
                }

                return(Ok(offerDto));
            }
            catch (AuthenticationFailedException)
            {
                return(Unauthorized("You can not update this offer."));
            }
            catch (ConditionFailedException exception)
            {
                return(BadRequest(exception.Message));
            }
        }
Ejemplo n.º 2
0
 // PUT: api/Offer/5
 public bool Put(int id, [FromBody] Offer offer)
 {
     return(_offerBusiness.UpdateOffer(id, offer));
 }