public IActionResult Create(int id, [FromBody] Dto.UpdateProduct newProductDto)
        {
            var newProduct = new Model.Product(id);

            Mapper.Map(newProductDto, newProduct);
            ProductsRepo.Create(newProduct);

            var createdProduct = ProductsRepo.GetById(id);

            Logger.LogInformation("New product was created: {@product}", createdProduct);

            return(Created($"{id}", Mapper.Map <Dto.Product>(createdProduct)));
        }
示例#2
0
 public void Create(Products products)
 {
     productsRepo.Create(products);
 }