I can take value of this query in a variable but when I am trying to take value of this query in the "artistList " it shows error :Error Message
This is the model :
public partial class tblArtist
{
public tblArtist()
{
this.tblArtistCategoryMappings = new HashSet<tblArtistCategoryMapping>();
this.tblArtistGroupMembers = new HashSet<tblArtistGroupMember>();
this.tblArtistPortfolios = new HashSet<tblArtistPortfolio>();
this.tblArtistRatings = new HashSet<tblArtistRating>();
this.tblArtistOverviews = new HashSet<tblArtistOverview>();
this.tblArtistSchedules = new HashSet<tblArtistSchedule>();
}
public int ArtistId { get; set; }
public string ArtistName { get; set; }
public Nullable<System.DateTime> DateOfBirth { get; set; }
public string Sex { get; set; }
public string HouseNumber { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Country { get; set; }
public string Pin { get; set; }
public string Email { get; set; }
public string Website { get; set; }
public string Phone { get; set; }
public string Mobile { get; set; }
public Nullable<bool> IsActive { get; set; }
public Nullable<bool> IsGroup { get; set; }
public Nullable<bool> IsFeatured { get; set; }
public Nullable<System.DateTime> AddedOn { get; set; }
public string AboutMe { get; set; }
public Nullable<decimal> MinmumRates { get; set; }
public string FB_FanLink { get; set; }
public Nullable<int> FK_UserId { get; set; }
public Nullable<bool> IsApproved { get; set; }
public virtual ICollection<tblArtistCategoryMapping> tblArtistCategoryMappings { get; set; }
public virtual ICollection<tblArtistGroupMember> tblArtistGroupMembers { get; set; }
public virtual ICollection<tblArtistPortfolio> tblArtistPortfolios { get; set; }
public virtual ICollection<tblArtistRating> tblArtistRatings { get; set; }
public virtual ICollection<tblArtistOverview> tblArtistOverviews { get; set; }
public virtual tblUser tblUser { get; set; }
public virtual ICollection<tblArtistSchedule> tblArtistSchedules { get; set; }
}
In Controller page I take a list like :
List<tblArtist> artistList = new List<tblArtist>();
This is the query :
artistList = (from ta in context.tblArtists
join tm in context.tblArtistCategoryMappings on ta.ArtistId equals tm.FK_ArtistId
join tc in context.tblArtistCategories on tm.FK_CategoryId equals tc.ArtistCategoryId
join tct in context.tblArtistCategoryTypes on tc.FK_ArtistCategoryTypeId equals tct.ArtistCategoryTypeId
where tct.ArtistCategoryTypeId == TypesId && ta.IsFeatured == true
select new
{
ta.AboutMe,
ta.AddedOn,
ta.Address,
ta.ArtistId,
ta.ArtistName,
ta.City,
ta.Country,
ta.DateOfBirth,
ta.Email,
ta.FB_FanLink,
ta.FK_UserId,
ta.HouseNumber,
ta.IsActive,
ta.IsApproved,
ta.IsFeatured,
ta.IsGroup,
ta.MinmumRates,
ta.Mobile,
ta.Phone,
ta.Pin,
ta.Sex,
ta.State,
ta.Website
}).ToList();