I have a linq query
, and want to assign string value to a string property, which in dependent on another int property value. I have saved int value in database, and now want to get appropriate string value for the saved integer value. Below is my query..
var data = db.ProjectSetups.Select(c => new ProjectSetup
{
ProjectId = c.ProjectId,
Name = c.Name,
NameArabic = c.NameArabic,
StartDate = c.StartDate,
EndDate = c.EndDate,
Date = c.Date,
StringType = (c.Type.ToInt32() == 1 ? "Development" : "Rental").ToString(),
StringStatus = (c.Status == 1 ? "InProgress" :
c.Status == 2 ? "Completed" :
c.Status == 3 ? "Dividend" : "Closed"),
LandArea = c.LandArea,
SaleAmount = c.SaleAmount
}).ToList();
I got below error
The entity or complex type 'PMISModel.ProjectSetup' cannot be constructed in a LINQ to Entities query