Exemplo n.º 1
0
        public IActionResult AddProduct([FromBody] UpsertProductModel model)
        {
            var result = DispatchCommand <AddProductCommand, ProductModel>(new AddProductCommand(model));

            return(CreatedAtAction(nameof(GetProduct), new { id = result.Id }, result));
        }
Exemplo n.º 2
0
        public IActionResult EditProduct([FromRoute] Guid id, [FromBody] UpsertProductModel model)
        {
            var result = DispatchCommand(new EditProductCommand(id, model));

            return(result.AsActionResult(Ok));
        }
Exemplo n.º 3
0
 public EditProductCommand(Guid id, UpsertProductModel model)
 {
     Id    = id;
     Model = model;
 }