/// <summary> /// Use this endpoint to send an offer update. This endpoint returns a process status. /// </summary> /// <param name="offerId">Unique identifier for an offer.</param> /// <param name="updateOffer">Offer update container.</param> /// <returns></returns> public async Task <StatusResponse> UpdateOffer(string offerId, UpdateOffer updateOffer) { using (var content = BolApiHelper.BuildContentFromObject(updateOffer)) { var response = await Put("/offers/" + offerId, content).ConfigureAwait(false); return(await BolApiHelper.GetContentFromResponse <StatusResponse>(response).ConfigureAwait(false)); } }
public async Task UpdateOffer() { var bolApiCaller = new BolApiCaller(testClientId, testClientSecret, true); var fulfilment = new SmallFulfilment(FulFilmentMethod.FBB); var offerUpdate = new UpdateOffer(fulfilment) { OnHoldByRetailer = true }; var firstOffer = openOffers.First(); var result = await bolApiCaller.Offers.UpdateOffer(firstOffer.OfferId.ToString(), offerUpdate); Assert.IsTrue(result.Description == "Update an offer with offerId 4ae7a221-65e7-a333-e620-3f8e1caab5c3."); }
public async Task UpdateAsync(UpdateOffer element, int id) { var offer = await _dbContext.Offer.SingleOrDefaultAsync(r => r.Id == id); if (offer == null) { throw new Exception("Oferta nie istnieje!"); } offer.SetOfferTitle(element.Title); offer.SetOfferDescription(element.Description); offer.SetOfferStartDate(element.StartDate); offer.SetOfferEndDate(element.EndDate); _dbContext.Offer.AttachRange(offer); await _dbContext.SaveChangesAsync(); }
public async Task <IActionResult> Update([FromRoute] int id, [FromBody] UpdateOffer command) { await _dataRepo.UpdateAsync(command, id); return(NoContent()); //return 204 code }