DI ConnectionString
This commit is contained in:
@@ -7,6 +7,13 @@ namespace FahrzeugeMVC.Controllers;
|
||||
|
||||
public class FahrzeugController : Controller
|
||||
{
|
||||
private readonly IKonfigurationsleser _konfigurationsleser;
|
||||
|
||||
public FahrzeugController(IKonfigurationsleser konfigurationsleser)
|
||||
{
|
||||
_konfigurationsleser = konfigurationsleser;
|
||||
}
|
||||
|
||||
public IActionResult Index(string searchTerm)
|
||||
{
|
||||
string connectionString = this.GetConnectionString();
|
||||
@@ -29,7 +36,7 @@ public class FahrzeugController : Controller
|
||||
|
||||
public string GetConnectionString()
|
||||
{
|
||||
return "Server=localhost;User ID=admin;Password=admin;Database=FahrzeugDB";
|
||||
return _konfigurationsleser.LiesDBVerebindung();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
||||
Reference in New Issue
Block a user