コード例 #1
0
        public async Task <IActionResult> GetAllForMerchant(string merchantId)
        {
            merchantId = Uri.UnescapeDataString(merchantId);

            try
            {
                IReadOnlyList <IMarkup> markups = await _markupService.GetForMerchantAsync(merchantId);

                return(Ok(Mapper.Map <IEnumerable <MarkupResponse> >(markups)));
            }
            catch (InvalidRowKeyValueException e)
            {
                _log.ErrorWithDetails(e, new
                {
                    e.Variable,
                    e.Value
                });

                return(NotFound(ErrorResponse.Create("Merchant not found")));
            }
        }
コード例 #2
0
        public async Task <IActionResult> GetAllForMerchant(string merchantId)
        {
            IMerchant merchant = await _merchantService.GetAsync(merchantId);

            if (merchant == null)
            {
                return(NotFound(ErrorResponse.Create("Merchant not found")));
            }

            try
            {
                IReadOnlyList <IMarkup> markups = await _markupService.GetForMerchantAsync(merchantId);

                return(Ok(Mapper.Map <IEnumerable <MarkupResponse> >(markups)));
            }
            catch (Exception ex)
            {
                await _log.WriteErrorAsync(nameof(MarkupsController), nameof(GetAllForMerchant), ex);

                throw;
            }
        }