Exemplo n.º 1
0
        public DataTable putPilotos(PilotosDto dto, int id)
        {
            using (con = new SqlConnection(dbContext.ObtenerCadenaDbConexSQL(_config["config:urlConex"])))
            {
                try
                {
                    tblResult = new DataTable();
                    con.Open();
                    if (con.State == ConnectionState.Open)
                    {
                        SqlDataAdapter cmd = new SqlDataAdapter(STORE_PROCEDURES.PUT_PILOTOS, con);
                        cmd.SelectCommand.CommandType = CommandType.StoredProcedure;
                        cmd.SelectCommand.Parameters.Add("@id", SqlDbType.Int).Value            = id;
                        cmd.SelectCommand.Parameters.Add("@nombres", SqlDbType.VarChar).Value   = dto.nombres;
                        cmd.SelectCommand.Parameters.Add("@apellidos", SqlDbType.VarChar).Value = dto.apellidos;
                        cmd.SelectCommand.Parameters.Add("@idAeronave", SqlDbType.Int).Value    = dto.idAeronave;
                        cmd.SelectCommand.Parameters.Add("@estado", SqlDbType.Bit).Value        = dto.estado;
                        cmd.Fill(tblResult);

                        cmd.Dispose();
                    }
                }
                catch (SqlException ex)
                {
                    con.Close();
                    throw new InvalidOperationException("TAG: " + ex.Message + ex.ErrorCode + ex.Data, ex.InnerException);
                }
                catch (Exception)
                {
                    throw new Exception();
                }
                con.Close();
                return(tblResult);
            }
        }
 public ResultDto putPilotos(PilotosDto dto, int id) => _repository.putPilotos(dto, id).AsResult();
 public ResultDto putPilotos([FromBody] PilotosDto dto, int id)
 {
     return(_service.putPilotos(dto, id));
 }
 public ResultDto setPilotos(PilotosDto dto) => _repository.setPilotos(dto).AsResult();
 public ResultDto setPilotos([FromBody] PilotosDto dto)
 {
     return(_service.setPilotos(dto));
 }