/// <summary>
        /// Devuelve true si la situacion laboral es valida para solicitar un empleo. - /demandante/{dni}/situacionLaboral
        /// </summary>
        /// <param name="Dni"></param>
        /// <returns>MultipleDemandanteDniSituacionLaboralGet</returns>
        public IHttpActionResult GetByDniSituacionLaboral([FromUri] string Dni)
        {
            // TODO: implement GetByDniSituacionLaboral - route: demandante/{dni}/situacionLaboral
            // var result = new MultipleDemandanteDniSituacionLaboralGet();
            // return Ok(result);
            MultipleDemandanteDniSituacionLaboralGet resp = new MultipleDemandanteDniSituacionLaboralGet();
            MySqlConnection connection = null;

            try
            {
                connection = new MySqlConnection("host=localhost; port=3306; user=usuario; password=; database=mtis_final");
                connection.Open();
                MySqlCommand command = new MySqlCommand();
                command.Connection  = connection;
                command.CommandText = "SELECT * FROM demandante WHERE dni=@dni";
                command.Prepare();
                command.Parameters.AddWithValue("@dni", Dni);
                MySqlDataReader    resultSet = command.ExecuteReader();
                ResponseDemandante response  = new ResponseDemandante();

                if (resultSet.Read())
                {
                    response.Estado = (bool)resultSet[12];
                    if (response.Estado)//1 = demandante empleado actualmente
                    {
                        response.Mensaje = "Trabajando";
                    }
                    else
                    {//0 para desempleado
                        response.Mensaje = "Desempleado";
                    }


                    resp.ResponseDemandante = response;
                    resultSet.Close();
                    return(Ok(resp.ResponseDemandante));
                }

                else
                {
                    resp.ErrorDemandante         = new ErrorDemandante();
                    resp.ErrorDemandante.Codigo  = 404;
                    resp.ErrorDemandante.Mensaje = "No se encuentra el demandante con ese DNI";
                    return(Content(System.Net.HttpStatusCode.NotFound, resp.ErrorDemandante));
                }
            }

            catch (Exception e)
            {
                return(InternalServerError());//   Content(System.Net.HttpStatusCode.InternalServerError);
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
        /// <summary>
        /// Modificará la fecha de renovación del demandante. Servirá para cuando el demandante decida renovar su estancia en el sistema. - /demandante/{dni}/fechaRenovacion
        /// </summary>
        /// <param name="entradaFechaRenovacion">String con la fecha de renovacion</param>
        /// <param name="Dni"></param>
        /// <param name="restkey"></param>
        /// <returns>MultipleDemandanteDniFechaRenovacionPut</returns>
        public IHttpActionResult PutByDniFechaRenovacion([FromBody] ServiciosRest.Demandantes.Models.EntradaFechaRenovacion entradaFechaRenovacion, [FromUri] string Dni, [FromUri] string restkey)
        {
            // TODO: implement PutByDniFechaRenovacion - route: demandante/{dni}/fechaRenovacion
            // var result = new MultipleDemandanteDniFechaRenovacionPut();
            // return Ok(result);
            MultipleDemandanteDniFechaRenovacionPut resp = new MultipleDemandanteDniFechaRenovacionPut();
            MySqlConnection connection = null;

            try
            {
                connection = new MySqlConnection("host=localhost; port=3306; user=usuario; password=; database=mtis_final");
                connection.Open();
                MySqlCommand command = new MySqlCommand();
                command.Connection  = connection;
                command.CommandText = "UPDATE demandante SET fecha_renovacion=@fecha_renovacion " +
                                      "WHERE dni=@dni_demandante";

                command.Prepare();
                command.Parameters.AddWithValue("@fecha_renovacion", entradaFechaRenovacion.FechaRenovacion);
                command.Parameters.AddWithValue("@dni_demandante", Dni.ToString());

                if (command.ExecuteNonQuery() > 0)
                {
                    ResponseDemandante respuestaDemandante = new ResponseDemandante();
                    respuestaDemandante.Mensaje = "Se ha modificado la fecha de renovacion correctamente";
                    respuestaDemandante.Estado  = true;
                    return(Created("", respuestaDemandante));
                }

                else
                {
                    resp.ErrorDemandante         = new ErrorDemandante();
                    resp.ErrorDemandante.Codigo  = 400;
                    resp.ErrorDemandante.Mensaje = "Error al modificar la fecha de renovacion";

                    return(Content(System.Net.HttpStatusCode.BadRequest, resp.ErrorDemandante));
                }
            }

            catch (Exception e)
            {
                resp.ErrorDemandante         = new ErrorDemandante();
                resp.ErrorDemandante.Codigo  = 400;
                resp.ErrorDemandante.Mensaje = "Error al modificar la fecha de renovacion: " + e.Message.ToString();

                return(Content(System.Net.HttpStatusCode.BadRequest, resp.ErrorDemandante));
            }

            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }