コード例 #1
0
        public async Task <IActionResult> AddReward(AddRewardRequest request, CancellationToken cancellationToken)
        {
            var userProfileId = int.Parse(User.FindFirstValue(CustomClaimTypes.UserProfileIdentifier));

            var command = new AddRewardCommand
            {
                Name             = request.Name,
                PointsCost       = request.PointsCost,
                RewardCategoryId = request.RewardCategoryId,
                UserProfileId    = userProfileId
            };

            var result = await _mediator.Send(command, cancellationToken);

            return(this.GetResponseFromResult(result));
        }
コード例 #2
0
 public async Task <ActionResult <int> > Add(AddRewardCommand addRewardCommand)
 {
     return(Ok(await Mediator.Send(addRewardCommand)));
 }