public async Task <ActionResult> Confirm(string number, QuoteRequestFormModel quoteRequest) { await _quoteRequestBuilder.LoadQuoteRequestAsync(number, WorkContext.CurrentLanguage, WorkContext.AllCurrencies); EnsureQuoteRequestBelongsToCurrentCustomer(_quoteRequestBuilder.QuoteRequest); _quoteRequestBuilder.Update(quoteRequest).Confirm(); await _quoteRequestBuilder.SaveAsync(); _cartBuilder.TakeCart(WorkContext.CurrentCart); await _cartBuilder.FillFromQuoteRequest(_quoteRequestBuilder.QuoteRequest); await _cartBuilder.SaveAsync(); return(new HttpStatusCodeResult(HttpStatusCode.OK)); }
public async Task <ActionResult> ConfirmQuoteRequest(string number) { if (string.IsNullOrEmpty(number)) { throw new HttpException(404, string.Empty); } //Need lock to prevent concurrent access to same quote using (var lockObject = await AsyncLock.GetLockByKey("quote:" + number).LockAsync()) { var quoteRequest = await GetCustomerQuoteRequestByIdAsync(number); if (quoteRequest == null) { throw new HttpException(404, string.Empty); } _cartBuilder.TakeCart(WorkContext.CurrentCart); await _cartBuilder.FillFromQuoteRequest(quoteRequest); await _cartBuilder.SaveAsync(); } return(StoreFrontRedirect("~/cart/checkout")); }