Using the next code in my controller Index action, I try to display 2 fields contents in a razor view:
public class MyController : Controller
{
private MyEntities db = new MyEntities();
public ActionResult Index()
{
IEnumerable<Prod> signatures = from Prod in db.Products
select new Prod(Prod.ProductID, Prod.ProductName);
}
}
Previously I have created a class in the models folder and named it "Prod":
public class Prod
{
public int ProductID { get; set; }
public string ProductName { get; set; }
}
But when I run the project I fall in the next error:
MyProject.Controllers.MyController.Index()
not all code paths return a value
Any help please ?