1
我有一個查詢跳過查詢的一部分,如果項目文本爲空
return uow.CustomerRepo
.Get()
.Where
(
c=>
c.Firstname.StartsWith(customerSearch.Initial) &&
c.Surname == customerSearch.Surname &&
c.Email == customerSearch.Email &&
c.Postcode == customerSearch.PostCode
)
有沒有辦法跳過查詢的部分,如果東西customerSearch
是空的?
,所以我想跳過部分
c.Surname == customerSearch.Surname
如果
customerSearch.Surname
是空
我推薦'string.IsNullOrEmpty()' – BenVlodgi
非常感謝你 –