Beispiel #1
0
        public async Task <ActionResult <ProductDto> > PostProduct(ProductDto item)
        {
            var map_produ = _mapper.Map <Product>(item);

            _facturaContexto.Products.Add(map_produ);
            await _facturaContexto.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetProduct), new { id = item.Id }, item));
        }
        public async Task <ActionResult <ClientDto> > PostClient(ClientDto item)
        {
            var cli = new Client();

            cli.Name      = item.Name;
            cli.Telephone = item.Telephone;
            cli.Address   = item.Address;

            _facturaContexto.Clients.Add(cli);
            await _facturaContexto.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetClient), new { id = item.Id }, item));
        }