Beispiel #1
0
        public async Task TestaCreate()
        {
            var obj = new ProductCreateParameter()
            {
                Name            = "Teste",
                Description     = "descrição",
                Information     = "Informação de teste",
                Amount          = 20.0M,
                PurchaseDate    = DateTime.Today,
                SubcategoryCode = 1234
            };

            var response = await _controller.Post(obj);

            Assert.IsType <CreatedAtActionResult>(response.Result);
            Assert.IsType <ActionResult <ProductPresenter> >(response);
        }
Beispiel #2
0
        public async Task <ActionResult <ProductPresenter> > Post([FromBody] ProductCreateParameter product)
        {
            var result = await _productService.Create(product.ToModel());

            return(CreatedAtAction(nameof(Get), new { productCode = result.Code }, new ProductPresenter(result)));
        }