еще фиксы
This commit is contained in:
parent
bdd4869d77
commit
c21b7fe216
@ -73,12 +73,22 @@ namespace SchoolSchedule
|
||||
}
|
||||
try
|
||||
{
|
||||
StudentBindingModel model = new StudentBindingModel
|
||||
{
|
||||
Id = (_id.HasValue ? _id.Value : 0),
|
||||
FullName = textBox1.Text,
|
||||
GradeId = Convert.ToInt32(comboBox1.SelectedValue),
|
||||
};
|
||||
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,
|
||||
GradeId = Convert.ToInt32(comboBox1.SelectedValue),
|
||||
};
|
||||
var operationResult = (_id.HasValue ? _logicS.Update(model) : _logicS.Create(model));
|
||||
if (!operationResult)
|
||||
{
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user