public virtual async Task <CouponDto> OccupyAsync(Guid id, OccupyCouponInput input) { var coupon = await GetEntityByIdAsync(id); if (coupon.UserId != CurrentUser.GetId()) { throw new AbpAuthorizationException(); } if (coupon.OrderId.HasValue) { throw new CouponHasBeenOccupiedException(); } var couponTemplate = await _couponTemplateRepository.GetAsync(coupon.CouponTemplateId); coupon.SetOrderId(input.OrderId); await _repository.UpdateAsync(coupon, true); return(FillCouponTemplateData(await MapToGetOutputDtoAsync(coupon), couponTemplate)); }
public Task <CouponDto> OccupyAsync(Guid id, OccupyCouponInput input) { return(_service.OccupyAsync(id, input)); }