Пример #1
0
        public async Task <IActionResult> Boost([FromBody] BoostUserRequest boostUserRequest)
        {
            var command = new BoostUserCommand(boostUserRequest);
            var result  = await Mediator.Send(command);

            return(await ResponseBase(result));
        }
Пример #2
0
        public async Task <BaseResponse <BoostUserResponse> > Handle(BoostUserCommand request, CancellationToken cancellationToken)
        {
            var user = await _applicationDbContext.Users.FirstOrDefaultAsync(usr =>
                                                                             usr.Id == request.BoostUserRequest.UserId, cancellationToken);

            var response = new BaseResponse <BoostUserResponse>();

            if (user == null)
            {
                response.SetValidationErrors(new [] { "User does not exists" });
                return(response);
            }
            var boostUserResponse = new BoostUserResponse("User has been queued to be Boosted");

            response.SetIsOk(boostUserResponse);

            return(response);
        }