コード例 #1
0
        public async Task <ActionResult> Reject(string number)
        {
            await _quoteRequestBuilder.LoadQuoteRequestAsync(number, WorkContext.CurrentLanguage, WorkContext.CurrentCurrency);

            EnsureQuoteRequestBelongsToCurrentCustomer(_quoteRequestBuilder.QuoteRequest);

            using (await AsyncLock.GetLockByKey(_quoteRequestBuilder.QuoteRequest.Id).LockAsync())
            {
                _quoteRequestBuilder.Reject();
                await _quoteRequestBuilder.SaveAsync();
            }
            return(Ok());
        }
コード例 #2
0
        public async Task <ActionResult> Reject(string number)
        {
            await _quoteRequestBuilder.LoadQuoteRequestAsync(number, WorkContext.CurrentLanguage, WorkContext.AllCurrencies);

            EnsureThatIsItCustomerQuoteRequest(_quoteRequestBuilder.QuoteRequest);

            using (var lockObject = await AsyncLock.GetLockByKey(_quoteRequestBuilder.QuoteRequest.Id).LockAsync())
            {
                _quoteRequestBuilder.Reject();
                await _quoteRequestBuilder.SaveAsync();
            }
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
コード例 #3
0
        public async Task <ActionResult> RejectQuoteRequest(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);
                }

                _quoteRequestBuilder.TakeQuoteRequest(quoteRequest);
                _quoteRequestBuilder.Reject();
                await _quoteRequestBuilder.SaveAsync();
            }

            return(StoreFrontRedirect("~/account/quote-requests"));
        }