I am trying to save the class attendance for multiple students on click of submit button. I am able to create the blank records in the concern tables and then populate the data in view.
I have the following view model:
public class TeacherAttendanceModel
{
    #region Required Properties
        public long ScholarAttendanceId { get; set; }
        public string Student { get; set; }
        public bool Absent { get; set; }
        public string AbsentComment { get; set; }
        public bool Uniform { get; set; }
        public bool Homework { get; set; }
        public string HomeworkComment { get; set; }
        public String UniformCommentSelected { get; set; }
        public IEnumerable<String> UniformComment { get; set; }
    #endregion
}
My Controller is as below.
public class TeacherAttendanceController : Controller
{
    //
    // GET: /TeacherAttendance/
    public ActionResult Index()
    {
        long classId = Success.Business.Roles.Teacher.GetHomeRoomClassID(Convert.ToInt64(Session[GlobalVar.LOGGED_IN_ID]));
        var classAttendanceStatus = Success.Business.Entities.ClassAttendance.GetClassAttendanceStatus(classId);
        ViewBag.status = classAttendanceStatus;
        var attendanceData = TeacherAttendance.CreateClassAttendance(classId);
        return View(attendanceData);
    }
    [HttpPost]
    public ActionResult Index(IEnumerable<TeacherAttendanceModel> teacherAttendanceModel)
    {
        try
        {
            if (ModelState.IsValid)
            {
                TeacherAttendance.SaveAttendance(teacherAttendanceModel);
            }
        }
        catch (Exception e)
        {
        }
        return View(teacherAttendanceModel);
    }
}
Get Index is working fine. But I am not getting the TeacheAttendanceModel object in Post index. I get null object. I would be thank full to get any help in this regards. How to update the multiple records of attendance on submit click?
I am using the following View:
@foreach (var item in Model) {
    <tr >
        <td style="border-style:solid; border-color:darkslategray; border-width:thin;">
            @Html.DisplayFor(modelItem => item.Student)
        </td>
        <td style="border-style:solid; border-color:darkslategray; border-width:thin;">
            @Html.CheckBoxFor(modelItem => item.Absent, ViewBag.status == 2 ? new {disabled = "disabled"} : null)
            @Html.TextBoxFor(modelItem => item.AbsentComment, ViewBag.status == 2 ? new {disabled = "disabled"} : null)
        </td>
        <td style="border-style:solid; border-color:darkslategray; border-width:thin;">
            @Html.CheckBoxFor(modelItem => item.Uniform, ViewBag.status == 2 ? new {disabled = "disabled"} : null)
            @Html.DropDownListFor(modelItem => item.UniformCommentSelected, new SelectList(item.UniformComment),item.UniformCommentSelected ?? "---Select---", ViewBag.status == 2? new {disabled = "disabled"} : null)
        </td>
        <td style="border-style:solid; border-color:darkslategray; border-width:thin;">
            @Html.CheckBoxFor(modelItem => item.Homework, ViewBag.status == 2 ? new {disabled = "disabled"} : null)
            @Html.TextBoxFor(modelItem => item.HomeworkComment, ViewBag.status == 2? new {disabled = "disabled"} : null)
        </td>
    </tr>
}
 
     
     
    