Code cleanup
This commit is contained in:
@@ -6,13 +6,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.Contracts
|
||||
{
|
||||
public interface IDataService<T>
|
||||
public interface IDataService<T>: IDisposable
|
||||
{
|
||||
Task<IEnumerable<T>> GetAll();
|
||||
Task<T> Get(int id);
|
||||
Task<T> Create(T entity);
|
||||
Task<T> Update(int id,T entity);
|
||||
Task<T> Update(T entity);
|
||||
Task<bool> Delete(int id);
|
||||
T CreateNonAsync(T entity);
|
||||
//T CreateNonAsync(T entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace SewerStammGen.Shared.Contracts
|
||||
{
|
||||
public interface ISchachtDataService : IDataService<Schacht>
|
||||
{
|
||||
Task<IEnumerable<Schacht>> GetAll(int projektID);
|
||||
Task<Schacht> GetSchachtByNameAndProjekt(string name, int projektID);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
using SewerStammGen.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);
|
||||
Task<Schacht> FindSchachtByNameAndProjektID(string name, int projektID);
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,11 @@ namespace SewerStammGen.Shared.Domain
|
||||
{
|
||||
public class Auftraggeber : DBObject
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public string? Strasse { get; set; }
|
||||
public string? Ort { get; set; }
|
||||
public string? Postleitzahl { get; set; }
|
||||
public string? Ansprechpartner { get; set; }
|
||||
public string? Telefonnummer { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
public string Strasse { get; set; } = String.Empty;
|
||||
public string Ort { get; set; } = String.Empty;
|
||||
public string Postleitzahl { get; set; } = String.Empty;
|
||||
public string Ansprechpartner { get; set; } = String.Empty;
|
||||
public string Telefonnummer { get; set; } = String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@ namespace SewerStammGen.Shared.Domain
|
||||
{
|
||||
public class Kanal : DBObject
|
||||
{
|
||||
public string? Objektbezeichnung { get; set; }
|
||||
public string Objektbezeichnung { get; set; } = String.Empty;
|
||||
public Schacht? StartSchacht { get; set; }
|
||||
public Schacht? EndSchacht { get; set; }
|
||||
public int DN { get; set; }
|
||||
public string? Material { get; set; }
|
||||
public string Material { get; set; } = String.Empty;
|
||||
public decimal Haltungslaenge { get; set; }
|
||||
public virtual Projekt? Projekt { get; set; }
|
||||
public Projekt? Projekt { get; set; }
|
||||
public EEntwaeserung Entwaesserung { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ namespace SewerStammGen.Shared.Domain
|
||||
{
|
||||
public class Projekt : DBObject
|
||||
{
|
||||
public string? Projektname { get; set; }
|
||||
public string? Erstelldatum { get; set; }
|
||||
public string? Strasse { get;set; }
|
||||
public string? Ort { get; set; }
|
||||
public string Projektname { get; set; } = String.Empty;
|
||||
public string Erstelldatum { get; set; } = String.Empty;
|
||||
public string Strasse { get; set; } = String.Empty;
|
||||
public string Ort { get; set; } = String.Empty;
|
||||
public Auftraggeber Auftraggeber { get; set; }
|
||||
public EExportType ExportType { get; set; }
|
||||
public EKodierungssystem Kodierungssystem { get; set; }
|
||||
|
||||
@@ -9,21 +9,12 @@ namespace SewerStammGen.Shared.Domain
|
||||
{
|
||||
public class Schacht : DBObject
|
||||
{
|
||||
public string? Objektbezeichnung { get; set; }
|
||||
|
||||
[Column(TypeName = "decimal(18,4)")]
|
||||
public string Objektbezeichnung { get; set; } = String.Empty;
|
||||
public decimal RechtsWert { get; set; }
|
||||
|
||||
[Column(TypeName = "decimal(18,4)")]
|
||||
public decimal HochWert { get; set; }
|
||||
|
||||
[Column(TypeName = "decimal(18,4)")]
|
||||
public decimal SohlHoehe { get; set; }
|
||||
|
||||
[Column(TypeName = "decimal(18,4)")]
|
||||
public decimal DeckelHoehe { get; set; }
|
||||
|
||||
public virtual Projekt? Projekt { get; set; }
|
||||
public Projekt? Projekt { get; set; }
|
||||
public EEntwaeserung Entwaesserung { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using Shared.Contracts;
|
||||
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;
|
||||
private readonly ISchachtDataService _schachtDataService;
|
||||
|
||||
public SchachtService(
|
||||
IDataService<Projekt> projectService,
|
||||
ISchachtDataService schachtDataService
|
||||
)
|
||||
{
|
||||
_projectService = projectService;
|
||||
_schachtDataService = schachtDataService;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public async Task<Schacht> FindSchachtByNameAndProjektID(string name, int projektID)
|
||||
{
|
||||
Schacht result = await _schachtDataService.GetSchachtByNameAndProjekt(name, projektID);
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Services\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user