еще фиксы

This commit is contained in:
gg12 darfren 2024-04-08 23:45:46 +04:00
parent bdd4869d77
commit c21b7fe216
2 changed files with 19 additions and 6 deletions

View File

@ -73,7 +73,17 @@ namespace SchoolSchedule
}
try
{
StudentBindingModel model = new StudentBindingModel
StudentBindingModel model;
if( _id.HasValue)
model =new StudentBindingModel
{
Id = (_id.HasValue ? _id.Value : 0),
FullName = textBox1.Text,
GradeId = Convert.ToInt32(comboBox1.SelectedValue),
Attendance = _logicS.ReadElement(new StudentSearchModel { Id = _id.Value}).Attendance
};
else
model = new StudentBindingModel
{
Id = (_id.HasValue ? _id.Value : 0),
FullName = textBox1.Text,

View File

@ -80,8 +80,11 @@ namespace SchoolScheduleDataBaseImplement.Models
context.SaveChanges();
foreach (var updateComponent in attendance)
{
updateComponent.Status = model.Attendance[updateComponent.LessonId].Item2;
updateComponent.Mark = model.Attendance[updateComponent.LessonId].Item3;
model.Attendance.Remove(updateComponent.LessonId);
}
context.SaveChanges();
}
var student = context.Students.First(x => x.Id == Id);
foreach (var pc in model.Attendance)