New to MVC3 Razor – linq to sql having spent some time trying to find how to:
Match the loged on UsersName to Customer.UserName and then select the Customer.CustomerID for the user.
public ViewResult Index()
{
var CustomerID = from c in Customer
where c.UserName = "User.Identity.Name"
select c.CustomerID;
return View();
}
Just use the actual variable: