Imprägnierungsliste hinzugefügt
This commit is contained in:
56
DaSaSo.EntityFramework/Services/ImpregnationDataService.cs
Normal file
56
DaSaSo.EntityFramework/Services/ImpregnationDataService.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using DaSaSo.Domain.Services;
|
||||
using DaSaSo.EntityFramework.Services.Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.EntityFramework.Services
|
||||
{
|
||||
public class ImpregnationDataService : IDataService<Impregnation>
|
||||
{
|
||||
private readonly DaSaSoDbContextFactory _contextFactory;
|
||||
private readonly NonQueryDataService<Impregnation> _nonQueryDataService;
|
||||
|
||||
public ImpregnationDataService(DaSaSoDbContextFactory contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
_nonQueryDataService = new NonQueryDataService<Impregnation>(contextFactory);
|
||||
}
|
||||
|
||||
public async Task<Impregnation> Create(Impregnation entity)
|
||||
{
|
||||
return await _nonQueryDataService.Create(entity);
|
||||
}
|
||||
|
||||
public Impregnation CreateNonAsync(Impregnation entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<bool> Delete(int id)
|
||||
{
|
||||
return await _nonQueryDataService.Delete(id);
|
||||
}
|
||||
|
||||
public Task<Impregnation> Get(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Impregnation>> GetAll()
|
||||
{
|
||||
using DaSaSoDbContext context = _contextFactory.CreateDbContext();
|
||||
IEnumerable<Impregnation> entities = await context.Impregnations.ToListAsync();
|
||||
return entities;
|
||||
}
|
||||
|
||||
public Task<Impregnation> Update(int id, Impregnation entity)
|
||||
{
|
||||
return _nonQueryDataService.Update(id, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user