45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
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;
|
|
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;
|
|
|
|
|
|
}
|
|
}
|
|
}
|