Hi Guys,
Just a simple one, please help me to combine two tables using include..
Code:
Public Class SurveyTemplate()
{
Public Guid Id { get; set; }
Public string AccountId { get; set; }
Public string Description { get; set; }
}
Public Class SurveyHistory()
{
public Guid id { get; set; }
Public Guid SurveyTemplateId { get; set }
Public SurveyTemplate SurveyTemplates { get; set; }
Public Guid AccountId { get; set; }
}
So this is my repository
Code:
Public async Task<List<SurveyHistory>> GetAllSurveyById(Guid accountId)
{
Var st = await Context.Set<SurveyHistory>()
.include(s => st.SurveyTemplates)
.Where(x => x.AccountId == accountId && x.SurveyTemplates.Id == x.SurveyTemplateId)
.ToListAsync();
}
I tried to other Models with the same Key Id, for example: Note Model with NoteId and Meeting Model with NotedId also, if I use the include, they both return a data, However using this kind of Model with different Id Key its not working, anyone can help me to combine this two table using Include.
Thank you