c# - Assign value to String Property based on integer Property value in Linq query -
i have linq query
, , want assign string value string property, in dependent on int property value. have saved int value in database, , want appropriate string value saved integer value. below 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 constructed in linq entities query
var data = db.projectsetups.tolist(); data = data.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();
Comments
Post a Comment