Exemplo n.º 1
0
        public async Task <ActionResult <Data.Models.ProductSubCategory> > PostSubCategory(Data.Models.ProductSubCategory subCategory)
        {
            if (subCategory == null)
            {
                return(BadRequest());
            }

            subCategory.Slug = Slug.Generate(subCategory.Title);

            await _subcategoryService.Create(subCategory);

            return(CreatedAtAction("GetSubcategory", new { id = subCategory.Id }, subCategory));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <Data.Models.Supplier> > PostSupplier(Data.Models.Supplier supplier)
        {
            if (supplier == null)
            {
                return(BadRequest());
            }

            supplier.Slug = Slug.Generate(supplier.CompanyName);

            await _supplierService.Create(supplier);

            return(CreatedAtAction("GetSupplier", new { id = supplier.Id }, supplier));
        }
Exemplo n.º 3
0
        public async Task <ActionResult <Product> > PostProduct(Data.Models.Product product)
        {
            if (product == null)
            {
                return(BadRequest());
            }

            product.Slug = Slug.Generate(product.Title);

            await _productService.Create(product);

            return(CreatedAtAction("GetProduct", new { id = product.Id }, product));
        }