I have the following problem, when returning a list generated in a method for a viewbag it throws an error to me at the moment of the return, I put the image to them so that they see where the error throws me
public List<Card> GetCard()
{
var user = db.Usuarios.Where(u => u.Email == User.Identity.Name).FirstOrDefault();
var card = (from Cards in db.Cards.Where(u => u.Id_Usuario == user.Id_Usuario)
select new Card
{
CardNumber = Cards.CardNumber.Replace((Cards.CardNumber.Substring(1 - 1, 12)), "************"),
IdCard = Cards.IdCard,
}).ToList();
card.Add(new Card
{
IdCard = 0,
CardNumber = "[Seleccione una tarjeta...]",
});
return card.OrderBy(a => a.CardNumber).ToList();
}
this is the error that is indicating me this is
SisVentaOnlinne.Models.Card' cannot be constructed in a LINQ to Entities query.
help