In a new MVC application, I am building out all of the models, controllers, views etc. without my backend DB setup yet. I have an idea of what the backed will look like, but for now I'm focusing on the application.
I know that I can mock up a dummy model within the controller like:
public ActionResult Pictures()
{
MyMVCApp.Models.Pictures pics = null;
MyMVCApp.Classes.Picture pic1 = new MyMVCApp.Classes.Picture
{
AlbumID=1,
Description="John Doh",
ThumbnailLocation = "Photos/Thumbnails/John.jpg"
};
MyMVCApp.Classes.Picture pic2 = new MyMVCApp.Classes.Picture
{
AlbumID = 2,
Description = "Jane Doh",
ThumbnailLocation = "Photos/Thumbnails/Jane.jpg"
};
pics = new Pictures
{
PageTitle="PHOTO ALBUMS",
PhotoAlbums = new List<MyMVCApp.Classes.PhotoAlbum>()
};
pics.PhotoAlbums.Add(new MyMVCApp.Classes.PhotoAlbum
{
AlbumID = 1,
AlbumName = "Test1",
AlbumCover = pic1,
Created = DateTime.Now.AddDays(-15)
});
pics.PhotoAlbums.Add(new MyMVCApp.Classes.PhotoAlbum
{
AlbumID = 2,
AlbumName = "Test2",
AlbumCover = pic2,
Created = DateTime.Now.AddDays(-11).AddHours(12)
});
return View(pics);
}
Doing this at least gives me something to look at on the view. My concern is when I'm ready to actually use the DB for my model, I don't want to lose my test Model.
How should I separate this out so that I don't have to change the View each time between the real controller and the test controller?