This question is locked. New answers and comments are not allowed.
Hey there guys,
I have the following method with a LINQ join and i am getting the following error where trying to set some fields...
Property or indexer 'AnonymousType#1.FirstName' cannot be assigned to -- it is read only
I'm obviously missing something. Any help would be great, I'm a little bit new to LINQ...
I have the following method with a LINQ join and i am getting the following error where trying to set some fields...
Property or indexer 'AnonymousType#1.FirstName' cannot be assigned to -- it is read only
I'm obviously missing something. Any help would be great, I'm a little bit new to LINQ...
public
void
setUser(UserObj userobj)
{
using
(BluefireDBContext db =
new
BluefireDBContext(conn))
{
try
{
var u = (from user
in
db.Users
join creds
in
db.Credentials on user.CredentialsID equals creds.CredentialsID
join acttype
in
db.AccountTypes on user.AccountTypeID equals acttype.AccountTypeID
join mobicar
in
db.MobiCarriers on creds.MobiCarrierID equals mobicar.MobiCarrierID
where creds.Email == userobj.Email
select
new
{
user.FirstName,
user.LastName,
creds.Email,
creds.Password,
creds.AuthPhone,
mobicar.MailDomain,
acttype.AcctTypeName,
creds.IsLocked,
creds.TemporaryToken,
creds.TokenExpiration
}).Single();
if
(u !=
null
)
{
u.FirstName =
""
;
...