Ejemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] CreateWarehouseModel model, [FromServices] IBus bus)
        {
            var command = WarehouseCommand.ToCreateCommand(model);

            await bus.Send(command).ConfigureAwait(false);

            return(Ok());
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            warehouse1 = new WarehouseCommand {
                locality = "SP",
                quantity = 12,
                type     = "PHYSICAL_STORE"
            };

            warehouse2 = new WarehouseCommand {
                locality = "SP",
                quantity = 12,
                type     = "ECOMMERCE"
            };

            warehouseZero = new WarehouseCommand {
                locality = "SP",
                quantity = 0,
                type     = "PHYSICAL_STORE"
            };
            var tempList = new List <WarehouseCommand>();

            tempList.Add(warehouse1);
            tempList.Add(warehouse2);

            inventory            = new InventoryCommand();
            inventory.warehouses = tempList.ToArray();


            validCommand = new CreateProductCommand {
                name      = "L'Oréal Professionnel Expert Absolut Repair Cortex Lipidium - Máscara de Reconstrução 500g",
                sku       = 43264,
                inventory = inventory
            };

            var zeroTempList = new List <WarehouseCommand>();
            var isMarketableFalseInventory = new InventoryCommand {
                warehouses = zeroTempList.ToArray()
            };

            isMarketableFalseCommand = new CreateProductCommand {
                name = "L'Oréal Professionnel Expert Absolut Repair Cortex Lipidium - Máscara de Reconstrução 500g",
                sku  = 43264,
                //inventory = isMarketableFalseInventory
            };

            invalidCommand = new CreateProductCommand
            {
                name = "",
                sku  = 0
            };

            repository = new ProductRepository();
            handler    = new ProductHandler(repository);
        }
Ejemplo n.º 3
0
        private void BtnSaveAndNew_Click(object sender, EventArgs e)
        {
            try
            {
                var telephone = int.Parse(txtTelephone.Text);

                Command = new WarehouseCommand(txtName.Text, GetState()
                                               , GetAddressState(), txtAddress.Text, telephone, txtEmail.Text, txtDescription.Text);

                Handler.Trigger(Command);

                CleanInputs();
            }
            catch (Exception warehouseCreateException)
            {
                labelError.Text = warehouseCreateException.Message;
            }
        }