Exemplo n.º 1
0
 // UPDATE exisiting gehege
 public int UpdateGehege(long id, GehegeInput gehege)
 {
     using (MySqlConnection conn = GetConnection())
     {
         conn.Open();
         MySqlCommand cmd = new MySqlCommand("UPDATE gehege SET Gehegeart = '" + gehege.Gehegeart + "', TierID = '" + gehege.TierID + "', ZooID = '" + gehege.ZooID + "' WHERE ID = '" + id + "';", conn);
         return(cmd.ExecuteNonQuery());
     }
 }
Exemplo n.º 2
0
 // CREATE new gehege
 public int CreateGehege(GehegeInput gehege)
 {
     using (MySqlConnection conn = GetConnection())
     {
         conn.Open();
         MySqlCommand cmd = new MySqlCommand("INSERT INTO gehege (Gehegeart, TierID, ZooID) VALUES ('" + gehege.Gehegeart + "', '" + gehege.TierID + "', '" + gehege.ZooID + "')", conn);
         return(cmd.ExecuteNonQuery());
     }
 }
Exemplo n.º 3
0
        public ActionResult <int> UpdateGehege(long id, GehegeInput gehege)
        {
            SQLConnectionGehege t = new("server=localhost;port=3306;database=ZooDatenbank;user=root;password=root");

            if (t.UpdateGehege(id, gehege) == 1)
            {
                return(1);
            }
            else
            {
                return(NotFound());
            }
        }
Exemplo n.º 4
0
        public ActionResult <GehegeInput> CreateGehege(GehegeInput gehege)
        {
            SQLConnectionGehege t = new("server=localhost;port=3306;database=ZooDatenbank;user=root;password=root");

            if (t.CreateGehege(gehege) >= 1)
            {
                return(gehege);
            }
            else
            {
                throw new Exception("didn't work");
            }
        }