public IActionResult Register([FromBody] LeilaoDto leilao)
        {
            // map dto to entity
            var leilaoEntity = _mapper.Map <Leilao>(leilao);

            try
            {
                // save
                _leilaoService.Criar(leilaoEntity);
                return(Ok(leilaoEntity));
            }
            catch (AppException ex)
            {
                // return error message if there was an exception
                return(BadRequest(new { message = ex.Message }));
            }
        }
        public IActionResult Atualizar(int id, [FromBody] LeilaoDto leilao)
        {
            // map dto to entity and set id
            var leilaoEntity = _mapper.Map <Leilao>(leilao);

            leilaoEntity.Id = id;

            try
            {
                // save
                _leilaoService.Atualizar(leilaoEntity);
                return(Ok());
            }
            catch (AppException ex)
            {
                // return error message if there was an exception
                return(BadRequest(new { message = ex.Message }));
            }
        }