예제 #1
0
        public async Task <IActionResult> GetCoupon(string couponCode)
        {
            try
            {
                var coupon = await _couponService.GetActivatedCouponsByCodeAsync(couponCode);

                if (coupon == null)
                {
                    return(NotFound("coupon not found"));
                }
                return(Ok(coupon));
            }
            catch (NotFoundException ex)
            {
                return(NotFound(ex.Message));
            }
            catch (Exception ex)
            {
                _logger.LogCritical($"GetCoupon() Error: {ex}");
                return(StatusCode(500, "Internal Server Error"));
            }
        }