예제 #1
0
        public async Task <IActionResult> Post([FromBody] CreateCustomerModel model)
        {
            var customerId = Guid.NewGuid().ToString();
            await bus.EnqueueAsync(new CreateCustomerFromApiCommand()
            {
                DomainObjectId = customerId, //Mandatory Id
                Name           = model.Name
            });

            var acceptedResult = new AcceptedResult();

            acceptedResult.Location = new Uri($"/api/customers/{customerId}", UriKind.Relative).ToString();

            return(acceptedResult);
        }
예제 #2
0
        public async Task <IActionResult> Post([FromBody] CreateCustomerModel model)
        {
            var customerId = Guid.NewGuid().ToString();

            //The bus will call the customer domain object
            await bus.EnqueueAsync(new CreateCustomerFromApiCommand()
            {
                DomainObjectId = customerId, //Mandatory Id
                Name           = model.Name
            });

            var acceptedResult = new AcceptedResult
            {
                //Give The Client a hint where to get the details( see below).
                Location = new Uri($"/api/customers/{customerId}", UriKind.Relative).ToString()
            };

            return(acceptedResult);
        }
예제 #3
0
        // GET
        public async Task <IActionResult> Index()
        {
            await bus.EnqueueAsync(new CreateCommand(Guid.NewGuid().ToString()) { Value = "aa" });

            return(Ok());
        }