Exemplo n.º 1
0
        public ActionResult Post([FromBody] ProductWriteDto writeDto)
        {
            ResultWrapper <ProductReadDto> result = _service.AddElement(writeDto);

            ModelState.UpdateErrors(result.GetErrors());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            return(Created($"api/products/{result.GetResult().Id}", result.GetResult()));
        }