static internal Gebruiker AddGebruikerToDB(Gebruiker gebruiker) { GebruikerMapper _gebruikermapper = new GebruikerMapper(); Int32? _adresId = null; if (gebruiker.Adres != null) { AdresMapper _adresMapper = new AdresMapper(); _adresId = _adresMapper.AddAdresToDB(gebruiker.Adres); } return(_gebruikermapper.AddGebruikerToDB(gebruiker, _adresId)); }
/* * private static Controller _controller; * * //constructor * private Controller(string connectionString) * { * _connectionString = connectionString; * } * * //singleton aanmaken * internal static Controller GetInstance(string connectionString) * { * if (_controller == null) _controller = new Controller(connectionString); * return _controller; * } * * internal static Controller GetInstance() * { * if (_controller == null) throw new ArgumentException(); * return _controller; * } */ //gebruikermethoden static internal List <Gebruiker> GetGebruikersFromDB() { List <Gebruiker> _gebruikersLijst; GebruikerMapper _gebruikermapper = new GebruikerMapper(); AdresMapper _adresMapper = new AdresMapper(); _gebruikersLijst = _gebruikermapper.GetGebruikersFromDB(); foreach (Gebruiker gebruiker in _gebruikersLijst) { _adresMapper.GetAdressFromDB((Int32)gebruiker.Id); } return(_gebruikersLijst); }