Files
DaSaSo/DaSaSo.EntityFramework/Services/SewerpointDataService.cs
2021-09-28 17:52:17 +02:00

63 lines
1.8 KiB
C#

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 SewerpointDataService : ISewerPointDataService
{
private readonly DaSaSoDbContextFactory _contextFactory;
private readonly NonQueryDataService<SewerPoint> _nonQueryDataService;
public SewerpointDataService(DaSaSoDbContextFactory contextFactory)
{
_contextFactory = contextFactory;
_nonQueryDataService = new NonQueryDataService<SewerPoint>(contextFactory);
}
public async Task<SewerPoint> Create(SewerPoint entity)
{
return await _nonQueryDataService.Create(entity);
}
public SewerPoint CreateNonAsync(SewerPoint entity)
{
throw new NotImplementedException();
}
public async Task<bool> Delete(int id)
{
return await _nonQueryDataService.Delete(id);
}
public Task<SewerPoint> Get(int id)
{
throw new NotImplementedException();
}
public Task<IEnumerable<SewerPoint>> GetAll()
{
throw new NotImplementedException();
}
public async Task<SewerPoint> GetbyObjektname(string objektname)
{
using (DaSaSoDbContext context = _contextFactory.CreateDbContext())
{
return await context.SewerPoints.FirstOrDefaultAsync((e) => e.Objektnummer == objektname);
}
}
public async Task<SewerPoint> Update(int id, SewerPoint entity)
{
return await _nonQueryDataService.Update(id, entity);
}
}
}