public ActionResult <Coupon> FindById(string id) { var coupon = _couponRepository.FindById(id); if (coupon == null) { return(NotFound()); } return(coupon); }
public CheckoutDto CalculateTotals(string cartId, string couponId) { var cart = GetCartFromDb(cartId); var checkoutDto = _checkOutEngine.CalculateTotals(cart); var coupon = _couponRepository.FindById(couponId); var couponDiscount = _couponEngine.CalculateDiscount(checkoutDto, coupon); checkoutDto.CouponDiscount = couponDiscount; return(checkoutDto); }
public CouponDto FindCouponById(string id) { var coupon = _couponRepository.FindById(id); return(_mapper.Map <CouponDto>(coupon)); }