I have SQL Query ready, and that I want its result into a complex SQL object. I want to use Linq to achieve the result.
public class VMPackageList
{
public string PackageName { get; set; }
public string ShortTitle { get; set; }
}
public class VMPackageItenary
{
public string PackageName { get; set; }
public string Day { get; set; }
public string Title { get; set; }
public string Detail { get; set; }
}
public class VMPackageHighlight
{
public string PackageName { get; set; }
public string Highlightname { get; set; }
public string HighlightDesc { get; set; }
}
The expected result in below class
public class VMPackageDetails
{
public VMPackageList vmPackage { get; set; }
public VMPackageItenary[] vmPackageItenary { get; set; }
public VMPackageHighlight[] vmPackageHighlights { get; set; }
}
Below are the SQL query and its result, the same way I want to get into SQL table data query
I had tried with below code to achieve but I did not get success
var packages = packageRepository.Table;
var highlights = packageHighlightRepository.Table;
var itenaries = packageItenaryRepository.Table;
var data = (from package in packages
join highlight in highlights on package.PackageName equals highlight.PackageName
join iteratory in itenaries on package.PackageName equals iteratory.PackageName //&&
where package.PackageName == packageName //&& highlight.PackageName equals iteratory.PackageName
select new VMPackageDetails
{
// vmPackage = package
}).ToList();
Can anyone help me to get the result?