Esempio n. 1
0
        public Task <FakeOrderIosCommandResponse> Handle(CreateFakeOrderIosCommand command)
        {
            var order = new FakeOrderIos(Guid.NewGuid(), command.FullName, command.CustomerId, command.AddressText,
                                         command.AddressLat, command.AddressLng,
                                         command.Items.Select(item => new FakeOrderIosItem(Guid.NewGuid(), item.ProductId, item.Name, item.Image,
                                                                                           item.Brand, item.Quantity)).ToList());

            _orderRepository.Add(order);
            return(Task.FromResult(new FakeOrderIosCommandResponse()));
        }
        public async Task <IHttpActionResult> Post(CreateFakeOrderIosCommand command)
        {
            var commandResponse =
                await Bus.Send <CreateFakeOrderIosCommand, FakeOrderIosCommandResponse>(command);

            var response = new ResponseModel
            {
                Message      = "Order was registered successfully",
                Success      = true,
                ResponseData = commandResponse
            };

            return(Ok(response));
        }