示例#1
0
        public async Task <IActionResult> PutEmpresa([FromRoute] long id, [FromBody] EmpresaDto empresaDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != empresaDto.Id)
            {
                return(BadRequest());
            }

            var empresa = _empresaServicio.Modificar(empresaDto);

            try
            {
                _empresaServicio.Guardar();
                // Verificar linea , no aplica
                return(Ok(empresa));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmpresaExiste(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
        }