public Benutzer(int id, string username, string passwort, Fach fach1, Fach fach2, Fach fach3, Fach fach4, Teststatistik statistik)
 {
     this.id = id;
     this.username = username;
     this.passwort = passwort;
     this.fach1 = fach1;
     this.fach2 = fach2;
     this.fach3 = fach3;
     this.fach4 = fach4;
     this.statistik = statistik;
 }
        //Liefert alle Fächer für einen bestimmten Benutzer
        //public List<Fach> GetFächer(string benutzerid)
        //{
        //    using (con = new SqlConnection(constring))
        //    {
        //        try
        //        {
        //            cmd = new SqlCommand("SELECT * FROM BenutzerDB WHERE ID = @benutzerId", con);
        //            cmd.Parameters.AddWithValue("@benutzerId", Convert.ToInt32(benutzerid));
        //            con.Open();
        //            reader = cmd.ExecuteReader();
        //            List<Fach> fächer = new List<Fach>();
        //            reader.Read();
        //            for (int i = 1; i <= 4; i++)
        //            {
        //                Fach fachNeu = new Fach();
        //                fachNeu.ID = i;
        //                fachNeu.Zeit = (string)reader["Fach" + i];
        //            }
        //            WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.OK;
        //            return fächer;

        //        }
        //        catch (Exception)
        //        {
        //            WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.BadRequest;
        //            return new List<Fach>();
        //        }
        //    }
        //}

        //Bearbeitet ein bestimmtes Fach eines bestimmten Benutzers
        public bool UpdateFach(string benutzerid, Fach fach)
        {
            using (con = new SqlConnection(constring))
            {
                try
                {
                    cmd = new SqlCommand("UPDATE BenutzerDB SET Fach" + fach.ID + " = @fachzeit WHERE ID = @benutzerId", con);
                    cmd.Parameters.AddWithValue("@benutzerId", Convert.ToInt32(benutzerid));
                    cmd.Parameters.AddWithValue("@fachzeit", fach.Zeit);
                    con.Open();
                    cmd.ExecuteNonQuery();
                    WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.OK;
                    return true;
                }
                catch (Exception)
                {
                    WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.BadRequest;
                    return false;
                }
            }
        }