直接舉例
private dynamic FetchDeptList(string orgCode)
{
return _deptRepo.Read(x => x.OrgCode == orgCode
&& (User.IsViewAll || User.AreaCodeList.Contains(x.AreaCode))
&& (User.IsViewAll || User.DeptCodeList.Contains(x.DeptCode))
&& x.Enable == true)
}
private dynamic FetchEmpList(string orgCode)
{
return _empRepo.Read(x => x.OrgCode == orgCode
&& (User.IsViewAll || User.AreaCodeList.Contains(x.AreaCode))
&& (User.IsViewAll || User.DeptCodeList.Contains(x.DeptCode))
&& x.Enable == true)
}
private dynamic FetchOfficeList(string orgCode)
{
return _officeRepo.Read(x => x.OrgCode == orgCode
&& (User.IsViewAll || User.AreaCodeList.Contains(x.AreaCode))
&& (User.IsViewAll || User.DeptCodeList.Contains(x.DeptCode))
&& x.Enable == true)
}
請問以上三個method 分別在不同的cs裡,但條件式又都一模一樣,有什麼方法可以簡化呢?