I am trying to learn MVC 3/4 using visual studio 2012. I have created a view, a model and controller. VS created all the database stuff for me. It added a gridview for me where I can add a new row, edit or delete too. I would like to change the way it selects the rows from the database. I know that I have to change the DbContext for that.
here is my DbContext,
public class ApartmentContext : DbContext
{
public ApartmentContext() : base("name=ApartmentContext")
{
}
// this part has to be changed****
public DbSet<Apartment> Apartments { get; set; }
}
public DbSet Apartments{...} returns the list I guess, but I want to change the way it selects the rows. For example; I want to select the rows whose "flag" column is set to 1. how do I do that?
thanks