Hi,
I had following Model:
public class UserInterestModel
{
public List
public string Type { get; set; }
}
public class category
{
public int categoryid { get; set; }
public List
}
public class subcategory
{
public int subCategoryId { get; set; }
public string? subCategoryName { get; set; }
}
Database tables:
usercategory : id, categoryname, subcategoryid, isActive
usersubcategory : id, subcategoryname, isActive
I want to retrieve the data from these two tables. For that I am writing the following code
UserInterestModel userInterestModel = new UserInterestModel();
List
List
categories = (from c in this._dataContext.Usercategories
join sc in this._dataContext.Usersubcategories on
c.Subcategoryid equals sc.Id
where c.Isactive == true && sc.Isactive == true
select new subCategories
Can you help me to complete the code or suggest the solution how i can read the data and bind it to my UserInterestModel

Jignesh KumarRank #91 · 22.9K reputationPosted Mar 14, 2022, 3:03 AM EDT
usercategory : id, categoryname, isActive
usersubcategory : id, subcategoryname, categoryId, isActive