how to print not mapped value
Posted
by
IcanMakeIt
on Stack Overflow
See other posts from Stack Overflow
or by IcanMakeIt
Published on 2012-10-29T15:09:14Z
Indexed on
2012/10/30
11:02 UTC
Read the original article
Hit count: 141
I am using complicated SQL queries, i have to use SqlQuery ... in simple way:
MODEL:
public class C
{
public int ID { get; set; }
[NotMapped]
public float Value { get; set; }
}
CONTROLLER:
IEnumerable<C> results = db.C.SqlQuery(@"SELECT ID, ATAN(-45.01) as Value from C);
return View(results.ToList());
VIEW:
@model IEnumerable<C>
@foreach (var item in Model) {
@Html.DisplayFor(modelItem => item.Value)
}
and the result for item.Value is NULL.
So my question is , how can i print the computed value from SQL Query ?
Thank you for help.
© Stack Overflow or respective owner