I am trying to access the DB I created to display a list. I am doing this in my controller. It is red underlining the db part. It is saying "The name db does not exist in the current context." Am I missing some thing to connect to the db in my code?
using System.Web;
using System.Web.Mvc;
using System.IO;
using System.Web.Helpers;
using MIS424Assignments.Models;
namespace MIS424Assignments.Controllers
{
[Authorize (Users="[email protected]")]
public class RetailController : Controller
{
// GET: Retail
[AllowAnonymous]
public ActionResult Index()
{
string sql = "Select * from Product order by newid()";
List<Product> productList = db.Product.SqlQuery(sql).ToList();
return View();
}
}
}