Church.Net.API/Church.Net.WebAPI/Controllers/CellGroupRoutineEventsController.cs
2024-05-02 15:24:13 -07:00

72 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Church.Net.DAL.EF;
using Church.Net.Entity;
using Church.Net.Utility;
using Church.Net.DAL.EFCoreDBF;
using WebAPI.Logics;
using WebAPI.Logics.Interface;
namespace WebAPI.Controllers
{
[Route("[controller]/[action]")]
[ApiController]
public class CellGroupRoutineEventsController : ApiControllerBase<CellGroupRoutineEvent>
{
private readonly PastoralDomainLogic logic;
private readonly ICombinedKeyCrudLogic<CellGroupRoutineEventPrayer> prayerLogic;
private readonly ICombinedKeyCrudLogic<CellGroupRoutineEventAttendee> dinnerLogic;
public CellGroupRoutineEventsController(
PastoralDomainLogic logic,
ICrudLogic<CellGroupRoutineEvent> crudLogic,
ICombinedKeyCrudLogic<CellGroupRoutineEventPrayer> prayerLogic,
ICombinedKeyCrudLogic<CellGroupRoutineEventAttendee> dinnerLogic
) : base(crudLogic)
{
this.logic = logic;
this.prayerLogic = prayerLogic;
this.dinnerLogic = dinnerLogic;
}
// GET: api/CellGroupRoutineEvents
[HttpGet]
public CellGroupRoutineEvent GetComingEvent()
{
return logic.GetComingEvent();
}
[HttpGet]
public CellGroupRoutineEvent GetLastEvent()
{
return logic.GetLastEvent();
}
[HttpPost]
public int CreateOrUpdatePrayer(CellGroupRoutineEventPrayer p)
{
return prayerLogic.CreateOrUpdate(p);
}
[HttpPost]
public int CreateOrUpdateAttendees(CellGroupRoutineEventAttendee p)
{
return dinnerLogic.CreateOrUpdate(p);
}
}
[Route("[controller]/[action]")]
[ApiController]
public class CellGroupRoutineEventPrayerController : CombinedKeyApiControllerBase<CellGroupRoutineEventPrayer>
{
public CellGroupRoutineEventPrayerController(ICombinedKeyCrudLogic<CellGroupRoutineEventPrayer> logic) : base(logic)
{
}
}
}