I want to retrieve a date from a database. I am using this LINQ query: this is my whole controller
[HttpGet]
public ActionResult FillSettlementDate(string Tenor1)
{
DateTime issueDate = Convert.ToDateTime(Session["IssueDate1"]);
int aucid = Convert.ToInt32(Session["auctionid"]);
string products= Convert.ToString(Session["Product_Id"]);
var SettleDate = db.AUCDATA_TENORS
.Where(c => c.TENOR_ID == Tenor1 && c.ISSUE_DATE == issueDate && c.AUCTION_ID ==aucid && c.PRODUCT_ID ==products)
.Select(c => c.SETTLE_DATE).ToList();
return Json(SettleDate, JsonRequestBehavior.AllowGet);
}
it is giving me Not Supported Exception
An exception of type 'System.NotSupportedException' occurred in System.Data.Entity.dll but was not handled in user code
Additional information: LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.
I want to retrieve this date and pass it in JSON
return Json(SettleDate, JsonRequestBehavior.AllowGet);