Beispiel #1
0
        public override async Task <EmailChangeReply> RequestEmailUpdate(EmailChangeRequest request, ServerCallContext context)
        {
            var reqestObject = new AuthorizedRequestObject <EmailChangeRequest, EmailChangeReply>(request)
            {
                // TODO: how it works
                UserId = context.GetHttpContext().User.GetUserId()
            };
            EmailChangeReply reply = await mediator.Send(reqestObject).ConfigureAwait(false);

            return(reply);
        }
Beispiel #2
0
        public async Task <IActionResult> UpdateEmail([FromBody] EmailChangeRequest request)
        {
            try
            {
                var reqestObject = new AuthorizedRequestObject <EmailChangeRequest, EmailChangeReply>(request)
                {
                    UserId = User.GetUserId()
                };
                EmailChangeReply reply = await mediator.Send(reqestObject).ConfigureAwait(false);

                return(Ok(reply));
            }
            catch (ArgumentNullException e)
            {
                return(BadRequest(e.Message));
            }
        }