public void MofidyAirlineDetails(LoginToken <AirlineCompany> token, AirlineCompany airline) { if (token.User.Id == airline.Id) { _airlineDAOPGSQL.Update(airline); } else { Console.WriteLine("the id of the token and the id of the modified airline does not match"); } }
public void RemoveAirline(LoginToken <Administrator> token, AirlineCompany airline) { if (token.User.Level > 1) { _airlineDAOPGSQL.Remove(airline); } else { Console.WriteLine("administrator level 1 cant remove airlines"); } }
public void CreateNewAirline(LoginToken <Administrator> token, AirlineCompany airline) { if (token.User.Level > 1) { _airlineDAOPGSQL.Add(airline); } else { Console.WriteLine("administrator level 1 cant create new airlines"); } }
public AirlineCompany GetAirlineByUserame(string name) { AirlineCompany a = new AirlineCompany(); using (NpgsqlConnection con = new NpgsqlConnection(connection_string)) { con.Open(); NpgsqlCommand cmd = new NpgsqlCommand($"select * from get_airline_by_username('{name}')", con); cmd.CommandType = System.Data.CommandType.Text; var reader = cmd.ExecuteReader(); while (reader.Read()) { a.Id = (long)reader.GetValue(0); a.Name = (string)reader.GetValue(1); a.CountryID = (int)reader.GetValue(2); a.UserId = (long)reader.GetValue(3); } } return(a); }
public void Update(AirlineCompany a) { ExecuteNonQuery($"call update_airline({a.Id},'{a.Name}', {a.CountryID}, {a.UserId})"); }
public void Remove(AirlineCompany a) { ExecuteNonQuery($"call remove_airline({a.Id})"); }
public void Add(AirlineCompany a) { ExecuteNonQuery($"call add_airline('{a.Name}', {a.CountryID}, {a.UserId})"); }
public void UpdateAirlineDetails(LoginToken <Administrator> token, AirlineCompany airline) { _airlineDAOPGSQL.Update(airline); }