Schächte werden nun hinzugefügt
This commit is contained in:
14
Shared/Contracts/IProjektDataService.cs
Normal file
14
Shared/Contracts/IProjektDataService.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Shared.Contracts;
|
||||
using Shared.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.Shared.Contracts
|
||||
{
|
||||
public interface IProjektDataService : IDataService<Projekt>
|
||||
{
|
||||
}
|
||||
}
|
||||
15
Shared/Contracts/ISchachtDataService.cs
Normal file
15
Shared/Contracts/ISchachtDataService.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Shared.Contracts;
|
||||
using Shared.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.Shared.Contracts
|
||||
{
|
||||
public interface ISchachtDataService : IDataService<Schacht>
|
||||
{
|
||||
Task<IEnumerable<Schacht>> GetAll(int projektID);
|
||||
}
|
||||
}
|
||||
14
Shared/Contracts/ISchachtService.cs
Normal file
14
Shared/Contracts/ISchachtService.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Shared.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.Shared.Contracts
|
||||
{
|
||||
public interface ISchachtService
|
||||
{
|
||||
Task<Schacht> CreateSchacht(Projekt proj);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace Shared.Domain
|
||||
public Auftraggeber Auftraggeber { get; set; }
|
||||
public EExportType ExportType { get; set; }
|
||||
public EKodierungssystem Kodierungssystem { get; set; }
|
||||
public IList<Kanal> Kanaele { get; set; }
|
||||
public IList<Schacht> Schaechte { get; set;}
|
||||
public IList<Kanal> Kanaele { get; set; } = new List<Kanal>();
|
||||
public IList<Schacht> Schaechte { get; set;} = new List<Schacht>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Shared.Domain
|
||||
{
|
||||
public class Schacht : DBObject
|
||||
{
|
||||
public string? Objektbezeichnung { get; set; }
|
||||
public string? Objektbezeichnung { get; set; }
|
||||
|
||||
[Column(TypeName = "decimal(18,4)")]
|
||||
public decimal RechtsWert { get; set; }
|
||||
@@ -22,6 +22,8 @@ namespace Shared.Domain
|
||||
|
||||
[Column(TypeName = "decimal(18,4)")]
|
||||
public decimal DeckelHoehe { get; set; }
|
||||
|
||||
public virtual Projekt? Projekt { get; set; }
|
||||
public EEntwaeserung Entwaesserung { get; set; }
|
||||
}
|
||||
|
||||
|
||||
31
Shared/Services/SchachtService.cs
Normal file
31
Shared/Services/SchachtService.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using Shared.Contracts;
|
||||
using Shared.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.Shared.Services
|
||||
{
|
||||
public class SchachtService : ISchachtService
|
||||
{
|
||||
private readonly IDataService<Projekt> _projectService;
|
||||
|
||||
public SchachtService(IDataService<Projekt> projectService)
|
||||
{
|
||||
_projectService = projectService;
|
||||
}
|
||||
|
||||
public async Task<Schacht> CreateSchacht(Projekt proj)
|
||||
{
|
||||
Schacht schacht = new Schacht() {
|
||||
Projekt = proj
|
||||
};
|
||||
proj.Schaechte.Add(schacht);
|
||||
await _projectService.Update(proj.Id, proj);
|
||||
return schacht;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user