Exemple #1
0
        public async Task <string> CreateProduct(models.Product product)
        {
            var producExisting = await GetProduct(product.Sku);

            if (producExisting != null)
            {
                return("Já existe produto com o sku informado!");
            }

            return(await _repositoryProduct.insertProduct(product));
        }
Exemple #2
0
        public async Task <string> UpdateProduct(models.Product product, int sku)
        {
            var producExisting = await GetProduct(sku);

            if (producExisting == null)
            {
                return("Não existe produto com o sku informado!");
            }

            return(await _repositoryProduct.UpdateProduct(sku, product));
        }
Exemple #3
0
        private models.Product makeNewProcuctTest(int sku)
        {
            var product = new models.Product()
            {
                Sku       = sku,
                Name      = "L'Oréal Professionnel Expert Absolut Repair Cortex Lipidium - Máscara de Reconstrução 500g",
                Inventory = new models.Inventory()
                {
                }
            };

            var listWarehouses = new List <models.Warehouse>();

            listWarehouses.Add(
                new models.Warehouse()
            {
                locality = "MOOCA",
                quantity = 12,
                type     = "ECOMMERCE"
            }
                );

            listWarehouses.Add(
                new models.Warehouse()
            {
                locality = "MOOCA",
                quantity = 12,
                type     = "ECOMMERCE"
            }

                );

            product.Inventory.Warehouses = listWarehouses;

            return(product);
        }