50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using Church.Net.DAL.EFCoreDBF;
|
|
using Church.Net.Entity;
|
|
using Church.Net.Entity.Interface;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using WebAPI.Logics.Core;
|
|
using WebAPI.Logics.Interface;
|
|
|
|
namespace WebAPI.Logics
|
|
{
|
|
public class LineMessagingAccountLogic : LogicBase<LineMessagingAccount>, ICrudLogic<LineMessagingAccount>
|
|
{
|
|
private readonly ICrudDAL<HappinessGroup> happinessGroupDAL;
|
|
private readonly ICrudDAL<PastoralDomain> cellGroupDAL;
|
|
|
|
public LineMessagingAccountLogic(
|
|
LogicService logicService,
|
|
ICrudDAL<LineMessagingAccount> crudDAL,
|
|
ICrudDAL<HappinessGroup> happinessGroupDAL,
|
|
ICrudDAL<PastoralDomain> cellGroupDAL
|
|
) : base(logicService, crudDAL)
|
|
{
|
|
this.happinessGroupDAL = happinessGroupDAL;
|
|
this.cellGroupDAL = cellGroupDAL;
|
|
}
|
|
|
|
public HappinessGroup GetHappinessGroup(string lineGroupId)
|
|
{
|
|
var group= happinessGroupDAL.First(c => c.CommunityAppId == lineGroupId);
|
|
GetLineMessagingAccount(group);
|
|
return group;
|
|
}
|
|
public PastoralDomain GetCellGroup(string lineGroupId)
|
|
{
|
|
var group = cellGroupDAL.First(c => c.CommunityAppId == lineGroupId);
|
|
GetLineMessagingAccount(group);
|
|
return group;
|
|
}
|
|
|
|
private void GetLineMessagingAccount(IMessengerClient messengerClient)
|
|
{
|
|
if (messengerClient != null)
|
|
{
|
|
messengerClient.LineMessagingAccount = crudDAL.GetById(messengerClient.LineAccountId);
|
|
}
|
|
}
|
|
}
|
|
}
|