Exemplo n.º 1
0
        public async Task <IActionResult> Create([FromBody] AccountModel model)
        {
            var command = model.Adapt <CreateAccountCommand>();

            command.UserId = CurrentUserId;

            var account = await _mediator.Send(command);

            await _mediator.Send(new LogActionCommand
            {
                AccountId  = account.Id,
                ActionType = ActionType.Create
            });

            return(Ok(account));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(AccountModel model, Guid accountId)
        {
            var command = model.Adapt <EditAccountCommand>();

            command.UserId    = CurrentUserId;
            command.AccountId = accountId;

            var account = await _mediator.Send(command);

            await _mediator.Send(new LogActionCommand
            {
                AccountId  = account.Id,
                ActionType = ActionType.Edit
            });

            return(Ok(account));
        }