예제 #1
0
        public async Task <IActionResult> Rename(Guid id, RenameCustomerModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (model.CommandId == Guid.Empty)
            {
                model.CommandId = NewId.NextGuid();
            }

            var command = new RenameCustomerCommand(model, id);

            await Send(command);

            return(Accepted(new PostResult <RenameCustomerCommand>()
            {
                CommandId = id,
                Timestamp = command.Timestamp
            }));
        }
예제 #2
0
 public RenameCustomerCommand(RenameCustomerModel model, Guid id)
 {
     _model    = model;
     Timestamp = DateTime.UtcNow;
     Id        = id;
 }