Firstly, I'm new to MVC - and trying out ASP.NET MVC3.
I want to build a page that looks like this:
Start Date: [Date Box] End Date: [Date Box] [Search Button]
[Table of Results]
The user enters a start and end date (which must be validated), then they click the Search button and it comes back with the matching results.
So, how do I structure this? Here's my idea of a Model class:
public class ResultSearchModel
{
[Required]
[DataType((DataType.DateTime))]
[DisplayName("Start Date")]
public DateTime StartDate { get; set; }
[Required]
[DataType((DataType.DateTime))]
[DisplayName("End Date")]
public DateTime EndDate { get; set; }
public List<ServiceEntry> ServiceEntries { get; set; }
}
public class ServiceEntry
{
public DateTime Date { get; set; }
public string Code { get; set; }
public string Details { get; set; }
}
So, my Index controller action should contruct an instance of the ResultSearchModel and return a View with this model?
Do I do this in one view, or do I have to have a partial view for the list part?