コード例 #1
0
        public override async Task <CouponModel> CreateDiscount(CreateDiscountRequest request, ServerCallContext context)
        {
            var coupon = _mapper.Map <Coupon>(request.Coupon);

            _repository.CreateCoupon(coupon);
            await _repository.SaveChangesAsync();

            _logger.LogInformation("Coupon is successfully created. CategoryName : {CategoryName}", coupon.CategoryName);

            var couponModel = _mapper.Map <CouponModel>(coupon);

            return(couponModel);
        }