I am using below query to get the employee detail - If there is any fulltime employee exist we need to display that employee if not need to pull default employee.
But some how even though first condition exist (which means we have full time employee exist) but still it is getting default employee too. and displaying both employee information which is wrong.
I also tried below query but getting run time error when I am excecuting it.
I am new to SQL and LINQ. if I post it in wrong place please let me know. so just want to check what is wrong with above query ? Can anyone help me on this please ?
var fulltimeemployees= db.Table().Where(fl => siteId == null || fl.SiteId == siteId).Select(l => l.LanguageId)
Above you end by select LanguageId so fulltimeemployees is a list of language Ids.
I dont think that is what you want?
And in the following you go right back to db.Table and query whether the fte list contains e.Id which it always will because fte list comes from db.table from your first query
employees = db.Table().Where(e => fulltimeemployees.Contains(e.Id) || e.IsDefault).ToList()