Generic Service
JSON Reference loop Events
This commit is contained in:
26
LaDOSE.Src/LaDOSE.Service/Service/EventService.cs
Normal file
26
LaDOSE.Src/LaDOSE.Service/Service/EventService.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user