Imprägnierungsliste hinzugefügt

This commit is contained in:
HuskyTeufel
2021-10-15 10:43:47 +02:00
parent 3b97a912bc
commit 6cf888c5e3
12 changed files with 184 additions and 7 deletions

View 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);
}
}
}