REST to a .Net Standard Library
Test REST in discord bot and WPF Small improvements
This commit is contained in:
@@ -6,6 +6,7 @@ namespace LaDOSE.Business.Interface
|
||||
{
|
||||
public interface IWordPressService
|
||||
{
|
||||
WPEvent GetNextWpEvent();
|
||||
List<WPEvent> GetWpEvent();
|
||||
List<WPUser> GetBooking(int wpEventId, Game game);
|
||||
List<WPUser> GetBookingOptions(int wpEventId, Game game);
|
||||
|
||||
@@ -15,11 +15,25 @@ namespace LaDOSE.Business.Service
|
||||
{
|
||||
}
|
||||
|
||||
public override Game AddOrUpdate(Game entity)
|
||||
{
|
||||
if (entity.Order == 0)
|
||||
{
|
||||
entity.Order = GetNextFreeOrder();
|
||||
}
|
||||
|
||||
return base.AddOrUpdate(entity);
|
||||
}
|
||||
|
||||
public override IEnumerable<Game> GetAll()
|
||||
{
|
||||
return _context.Game.Include(e => e.Seasons).ThenInclude(e=>e.Season).ToList();
|
||||
}
|
||||
|
||||
|
||||
public int GetNextFreeOrder()
|
||||
{
|
||||
int nextFreeOrder = _context.Game.Max(e => e.Order);
|
||||
return ++nextFreeOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,12 @@ namespace LaDOSE.Business.Service
|
||||
.ThenInclude(e => e.WPUser).Where(e => e.WPBookings.Count() != 0).Take(10).ToList();
|
||||
return wpEvents;
|
||||
}
|
||||
public WPEvent GetNextWpEvent()
|
||||
{
|
||||
var wpEvents = _context.Set<WPEvent>().OrderByDescending(e=>e.Date).ThenByDescending(e => e.Id)
|
||||
.Include(e => e.WPBookings).ThenInclude(e => e.WPUser).FirstOrDefault(e => Enumerable.Count<WPBooking>(e.WPBookings) != 0);
|
||||
return wpEvents;
|
||||
}
|
||||
|
||||
public bool UpdateBooking()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user