Generic Service

JSON Reference loop
Events
This commit is contained in:
2018-10-07 03:03:38 +02:00
parent 642d533a49
commit 9a9d4c7053
12 changed files with 270 additions and 117 deletions

View File

@@ -0,0 +1,26 @@
using System;
using LaDOSE.Business.Interface;
using LaDOSE.Entity;
using LaDOSE.Entity.Context;
namespace LaDOSE.Business.Service
{
public class EventService : BaseService<Event>, IEventService
{
public EventService(LaDOSEDbContext context) : base(context)
{
}
public override Event Create(Event e)
{
if (e.Id != 0)
{
throw new Exception("Id is invalid");
}
var eventAdded = _context.Event.Add(e);
_context.SaveChanges();
return eventAdded.Entity;
}
}
}