My website is going to have just 1 registered user and she is going to tell the visitor where her boyfriend is. If he is in town, I would like to redirect visitors to the InTown action of the HomeController. The corresponding view would have a green background and lack the buttons that let you know where he is, etc.
So this one user can log in, and edit my only database entry – These things are already working. But I cannot get my HomeController to read from the database and check InTown value (true or false) of the item that has an Id of “1”. Could you please help me?
I don’t really have much to show you here, I only have two classes in models that lets me interact with SqlServerCE (I’m using Entity Framework), and the most basic stuff.
If you are using entity framework, can’t you just use a where clause, such as:
db.Caglas.Where(c => c.ID == 1).SingleOrDefault();This is just a simple LINQ statement