I am new to MVC and am struggling to get my head round it coming from a web forms background.
I have two classes for a timesheet application, Week
and TimeEntry
:
public class Week
{
public int WeekID { get; set; }
public DateTime WeekStartDate { get; set; }
public string UserID { get; set; }
[ForeignKey("UserID")]
public virtual ApplicationUser ApplicationUser { get; set; }
public virtual ICollection<TimeEntry> TimeEntries { get; set; }
}
public class TimeEntry
{
public int TimeEntryID { get; set; }
public int ClientID { get; set; }
[ForeignKey("ClientID")]
public virtual Client Client { get; set; }
public double MonHours { get; set; }
public double TueHours { get; set; }
public double WedHours { get; set; }
public double ThuHours { get; set; }
public double FriHours { get; set; }
}
I want to be able to create the TimeEntry
objects "on the fly" from the Week
controller.
The idea is to have a way of inputting the time like this:
(I'm planning on using JQuery to create a new row when needed, but will try and figure this bit out later!)
Appreciate this is a noob question, but can't figure out what I need to be looking up on Google!