WIP dependency Injection
This commit is contained in:
37
DaSaSo.Domain/Services/ClientServices/ClientService.cs
Normal file
37
DaSaSo.Domain/Services/ClientServices/ClientService.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.Domain.Services.ClientServices
|
||||
{
|
||||
public class ClientService : IClientService
|
||||
{
|
||||
private readonly IDataService<Client> _clientService;
|
||||
public async Task<bool> CreateNewClient(string firstname, string lastname, string street, string country, string postcode)
|
||||
{
|
||||
Client client = new Client()
|
||||
{
|
||||
Firstname = firstname,
|
||||
LastName = lastname,
|
||||
Country = country,
|
||||
Postcode = postcode,
|
||||
Street = street
|
||||
};
|
||||
await _clientService.Create(client);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Task<Client> GetClientById(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<Client> ListAllClient()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
16
DaSaSo.Domain/Services/ClientServices/IClientService.cs
Normal file
16
DaSaSo.Domain/Services/ClientServices/IClientService.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.Domain.Services.ClientServices
|
||||
{
|
||||
public interface IClientService
|
||||
{
|
||||
Task<Client> ListAllClient();
|
||||
Task<Client> GetClientById(int id);
|
||||
Task<bool> CreateNewClient(string firstname, string lastname, string street, string country, string postcode);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.Domain.Service
|
||||
namespace DaSaSo.Domain.Services
|
||||
{
|
||||
public interface IDataService<T>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user