WIP
This commit is contained in:
@@ -41,12 +41,12 @@ namespace WebAPI.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public virtual async Task<string> CreateOrUpdate([FromBody] T entity)
|
||||
public virtual async Task<T> CreateOrUpdate([FromBody] T entity)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
logic.CreateOrUpdate(entity, out string id);
|
||||
return id;
|
||||
return entity;
|
||||
});
|
||||
}
|
||||
[HttpPost]
|
||||
@@ -109,11 +109,12 @@ namespace WebAPI.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public virtual async Task<int> CreateOrUpdate([FromBody] T entity)
|
||||
public virtual async Task<T> CreateOrUpdate([FromBody] T entity)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
return logic.CreateOrUpdate(entity);
|
||||
logic.CreateOrUpdate(entity);
|
||||
return entity;
|
||||
});
|
||||
}
|
||||
[HttpPost]
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace WebAPI.Controllers
|
||||
[HttpPost]
|
||||
public int UpdateBestWeek(HappinessWeek week)
|
||||
{
|
||||
return weekLogic.CreateOrUpdate(week,out string id);
|
||||
return cellGroupLogic.UpdateWeekInfo(week);
|
||||
}
|
||||
|
||||
private Font arialFont;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using Church.Net.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WebAPI.Logics.Interface;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
{
|
||||
[Route("[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class ContributionController : ApiControllerBase<Contribution>
|
||||
{
|
||||
public ContributionController(ICrudLogic<Contribution> logic) : base(logic)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
using Church.Net.Entity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WebAPI.Logics.Interface;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
{
|
||||
[Route("[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class HappinessCostController : ApiControllerBase<HappinessCost>
|
||||
{
|
||||
|
||||
public HappinessCostController(ICrudLogic<HappinessCost> logic) : base(logic)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ using Jint.Native;
|
||||
using WebAPI.Services.Interfaces;
|
||||
using Church.Net.DAL.EFCoreDBF.Migrations;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using WebAPI.Logics;
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
@@ -36,16 +37,19 @@ namespace WebAPI.Controllers
|
||||
private readonly LineAutoBotService lineAutoBotService;
|
||||
private readonly ILoggingService loggingService;
|
||||
private readonly ICrudDAL<LineMessagingAccount> crudDAL;
|
||||
private readonly PastoralDomainLogic pastoralDomainLogic;
|
||||
|
||||
public LineMessageController(
|
||||
LineAutoBotService lineAutoBotService,
|
||||
ILoggingService loggingService,
|
||||
ICrudDAL<LineMessagingAccount> crudDAL
|
||||
ICrudDAL<LineMessagingAccount> crudDAL,
|
||||
PastoralDomainLogic pastoralDomainLogic
|
||||
)
|
||||
{
|
||||
this.lineAutoBotService = lineAutoBotService;
|
||||
this.loggingService = loggingService;
|
||||
this.crudDAL = crudDAL;
|
||||
this.pastoralDomainLogic = pastoralDomainLogic;
|
||||
}
|
||||
//private ChurchNetContext dbContext = new ChurchNetContext();
|
||||
//// GET: api/<BestController>
|
||||
@@ -109,11 +113,11 @@ namespace WebAPI.Controllers
|
||||
|
||||
}
|
||||
|
||||
//[HttpGet]
|
||||
//public Task PushCommandMessage(string groupToken, string command)
|
||||
//{
|
||||
// return lineAutoBotService.PushCommandMessage(EnumHelper.GetEnumValueFromDescription<LineGroup>(groupToken), "#" + command);
|
||||
//}
|
||||
[HttpGet]
|
||||
public Task PushCommandMessage(string groupId, string command)
|
||||
{
|
||||
return lineAutoBotService.PushCommandMessage(pastoralDomainLogic.GetById(groupId), "#" + command);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,28 +2,39 @@
|
||||
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 WebAPI.Logics;
|
||||
using WebAPI.Logics.Interface;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
{
|
||||
[Route("[controller]/[action]")]
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
public class PastoralDomainController : ApiControllerBase<PastoralDomain>
|
||||
{
|
||||
private readonly PastoralDomainLogic logic;
|
||||
|
||||
public PastoralDomainController(PastoralDomainLogic logic) : base(logic)
|
||||
{
|
||||
this.logic = logic;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public Task<IEnumerable<PastoralDomain>> GetCurrentUserPastoralDomain()
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
return logic.GetCurrentUserPastoralDomain();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Route("[controller]/[action]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class DomainMemberShipController : CombinedKeyApiControllerBase<PastoralDomainMembers>
|
||||
{
|
||||
public DomainMemberShipController(ICombinedKeyCrudLogic<PastoralDomainMembers> logic) : base(logic)
|
||||
@@ -43,5 +54,29 @@ namespace WebAPI.Controllers
|
||||
return 1;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public int AddMemberIntoGroup(string domainId, string memberId)
|
||||
{
|
||||
return logic.CreateOrUpdate(new PastoralDomainMembers() { PastoralDomainId = domainId, FamilyMemberId = memberId });
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public int RemoveMemberFromGroup(string domainId, string memberId)
|
||||
{
|
||||
return logic.Delete(r => r.PastoralDomainId == domainId && r.FamilyMemberId == memberId);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public int UpdateMembersInGroup(PastoralDomain domain)
|
||||
{
|
||||
logic.Delete(r => r.PastoralDomainId == domain.Id);
|
||||
foreach (var member in domain.FamilyMembers)
|
||||
{
|
||||
//logic.Delete(r => r.FamilyMemberId == relation.FamilyMemberId);
|
||||
logic.Create(new PastoralDomainMembers() { PastoralDomainId = domain.Id, FamilyMemberId = member.Id });
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace WebAPI.Controllers
|
||||
var templateMessage = new LineTemplateMessage<ButtonTemplateObject>();
|
||||
var addPrayerBtn = new UriAction()
|
||||
{
|
||||
Uri = "https://happiness.tours/CellGroup/prayer?openExternalBrowser=1",
|
||||
Uri = "https://happiness.tours/CellGroup/prayer",
|
||||
Label = "Prayer"
|
||||
};
|
||||
templateMessage.AltText = "代禱事項";
|
||||
|
||||
Reference in New Issue
Block a user