ServerError in '/' Application.
LINQ to Entities doesnot recognize the method 'System.Object get_Item(System.String)'
method, andthis method cannot be translated into a store expression.
A Linq query is translated to SQL to be performed against the database. Make sure you need to assign session or form request to a variable first because that has no access to it, and use this variable in the query.
int userId = (int)Session["UserId"];
var hasrecord = db.Submits
.Where(m =>m.Published == false && m.CreatedUserId ==userId)
.OrderByDescending(m => m.SubmitId);