datenbank referenzen geupdated
This commit is contained in:
@@ -14,15 +14,15 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
||||
{
|
||||
public class ProjektDataService : PostgresqlDataService, IProjektDataService
|
||||
{
|
||||
public ProjektDataService(string connectionstring) : base(connectionstring,"Projekte")
|
||||
public ProjektDataService(string connectionstring) : base(connectionstring,"projekt")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async Task<Projekt> Create(Projekt entity)
|
||||
{
|
||||
string command = "INSERT INTO "+tableName+" (\"Projektname\", \"Erstelldatum\", \"Strasse\", \"Ort\", \"ExportType\", \"Kodierungssystem\",\"AuftraggeberId\") " +
|
||||
"VALUES(@1,@2,@3,@4,@5,@6,@7) RETURNING \"Id\"";
|
||||
string command = "INSERT INTO "+tableName+" (projektname, erstelldatum, strasse, ort, exporttype, kodierungssystem,ref_auftraggeber_id) " +
|
||||
"VALUES(@1,@2,@3,@4,@5,@6,@7) RETURNING projekt_id";
|
||||
|
||||
if (entity.Auftraggeber.Id == 0)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
||||
{
|
||||
Projekt result = new Projekt();
|
||||
IAuftraggeberDataService auftraggeberDataService = new AuftraggeberDataService(connString);
|
||||
using (var cmd = new NpgsqlCommand($"SELECT * FROM "+tableName+" WHERE \"Id\" = @1", conn))
|
||||
using (var cmd = new NpgsqlCommand($"SELECT * FROM "+tableName+" WHERE projekt_id = @1", conn))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("1", id);
|
||||
using var reader = await cmd.ExecuteReaderAsync();
|
||||
@@ -99,7 +99,7 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
||||
|
||||
public async Task<Projekt> Update(Projekt entity)
|
||||
{
|
||||
string command = "UPDATE "+tableName+" SET \"Projektname\"=@1, \"Erstelldatum\"=@2, \"Strasse\"=@3, \"Ort\"=@4, \"ExportType\"=@5, \"Kodierungssystem\"=@6 WHERE \"Id\" = @8";
|
||||
string command = "UPDATE "+tableName+" SET projektname=@1, erstelldatum=@2, strasse=@3, ort=@4, exporttype=@5, kodierungssystem=@6 WHERE projekt_id = @8";
|
||||
using (var cmd = new NpgsqlCommand(command, conn))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("1", entity.Projektname);
|
||||
|
||||
Reference in New Issue
Block a user