C#
from ContentDetails in _dbContext.ContentDetails
join VersionDetails in _dbContext.VersionDetails on ContentDetails.Id equals VersionDetails.ContentId
join MstStage in _dbContext.MstStage on ContentDetails.Status equals MstStage.Id
where ContentDetails.FacultyName=like search here
select new
{
VersionDetails.ContentId,
ContentDetails.Id,
ContentDetails.DeptId,
ContentDetails.DeptName,
ContentDetails.CourseId,
ContentDetails.CourseName,
ContentDetails.Semester,
ContentDetails.PaperId,
ContentDetails.PaperName,
ContentDetails.ContentTypeId,
ContentDetails.ContenType,
ContentDetails.FacultyId,
ContentDetails.FacultyName,
ContentDetails.Topic,
ContentDetails.LanguageId,
ContentDetails.LanguageName,
MstStage.Mode,
VersionDetails.VersionId,
VersionDetails.VersionName,
VersionDetails.VersionNote,
ContentDetails.CreatedBy,
ContentDetails.CreatedOn,
ContentDetails.ModifiedBy,
ContentDetails.ModifiedOn
};
Naimish MakwanaRank #324 · 7.7K reputationPosted Feb 10, 2023, 10:51 AM EST
Hello Sandip,
you can use the
Containsmethod in LINQ to check if theFacultyNameproperty contains the search term.Example:
string searchTerm = "your search term here"; var result = from ContentDetails in _dbContext.ContentDetails join VersionDetails in _dbContext.VersionDetails on ContentDetails.Id equals VersionDetails.ContentId join MstStage in _dbContext.MstStage on ContentDetails.Status equals MstStage.Id where ContentDetails.FacultyName.Contains(searchTerm) select new { VersionDetails.ContentId, ContentDetails.Id, ContentDetails.DeptId, ContentDetails.DeptName, ContentDetails.CourseId, ContentDetails.CourseName, ContentDetails.Semester, ContentDetails.PaperId, ContentDetails.PaperName, ContentDetails.ContentTypeId, ContentDetails.ContenType, ContentDetails.FacultyId, ContentDetails.FacultyName, ContentDetails.Topic, ContentDetails.LanguageId, ContentDetails.LanguageName, MstStage.Mode, VersionDetails.VersionId, VersionDetails.VersionName, VersionDetails.VersionNote, ContentDetails.CreatedBy, ContentDetails.CreatedOn, ContentDetails.ModifiedBy, ContentDetails.ModifiedOn };Thanks
Naimish Makwana