Interktion im WPF erweitert
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.Domain.Services.BuildingsiteServices
|
||||
{
|
||||
public class BuildingsiteService : IBuildingsiteService
|
||||
{
|
||||
private readonly IDataService<Project> _projectService;
|
||||
|
||||
public BuildingsiteService(IDataService<Project> projectService)
|
||||
{
|
||||
_projectService = projectService;
|
||||
}
|
||||
|
||||
public async Task<Buildingsite> CreateBuildingsite(Project proj)
|
||||
{
|
||||
Buildingsite buildingsite = new Buildingsite()
|
||||
{
|
||||
Project = proj
|
||||
};
|
||||
proj.BuildingSites.Add(buildingsite);
|
||||
await _projectService.Update(proj.Id, proj);
|
||||
return buildingsite;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.Domain.Services.BuildingsiteServices
|
||||
{
|
||||
public interface IBuildingsiteService
|
||||
{
|
||||
Task<Buildingsite> CreateBuildingsite(Project proj);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ namespace DaSaSo.Domain.Services
|
||||
Task<IEnumerable<T>> GetAll();
|
||||
Task<T> Get(int id);
|
||||
Task<T> Create(T entity);
|
||||
T CreateNonAsync(T entity);
|
||||
Task<T> Update(int id, T entity);
|
||||
Task<bool> Delete(int id);
|
||||
}
|
||||
|
||||
14
DaSaSo.Domain/Services/ProjectServices/IProjectService.cs
Normal file
14
DaSaSo.Domain/Services/ProjectServices/IProjectService.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.Domain.Services.ProjectServices
|
||||
{
|
||||
public interface IProjectService
|
||||
{
|
||||
Task<Project> CreateProject(Client Auftraggeber);
|
||||
}
|
||||
}
|
||||
31
DaSaSo.Domain/Services/ProjectServices/ProjectService.cs
Normal file
31
DaSaSo.Domain/Services/ProjectServices/ProjectService.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.Domain.Services.ProjectServices
|
||||
{
|
||||
public class ProjectService : IProjectService
|
||||
{
|
||||
private readonly IDataService<Client> _clientService;
|
||||
|
||||
public ProjectService(IDataService<Client> clientService)
|
||||
{
|
||||
_clientService = clientService;
|
||||
}
|
||||
|
||||
public async Task<Project> CreateProject(Client Auftraggeber)
|
||||
{
|
||||
Project project = new Project()
|
||||
{
|
||||
Client = Auftraggeber
|
||||
};
|
||||
|
||||
Auftraggeber.Projects.Add(project);
|
||||
await _clientService.Update(Auftraggeber.Id, Auftraggeber);
|
||||
return project;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user