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.
Hide Copy Code
var employees = new List();
var fulltimeemployees= db.Table().Where(fl => siteId == null || fl.SiteId == siteId).Select(l => l.LanguageId)
employees = db.Table().Where(e => fulltimeemployees.Contains(e.Id) || e.IsDefault).ToList();
return employees ;
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.
employees = db.Table().Where(e => fulltimeemployees.Where(x=> x.EmployeeId ==e.Id).Any() || e.IsDefault).ToList();
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 ?
Thank you in advance.