еще фиксы
This commit is contained in:
parent
bdd4869d77
commit
c21b7fe216
@ -73,12 +73,22 @@ namespace SchoolSchedule
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StudentBindingModel model = new StudentBindingModel
|
StudentBindingModel model;
|
||||||
{
|
if( _id.HasValue)
|
||||||
Id = (_id.HasValue ? _id.Value : 0),
|
model =new StudentBindingModel
|
||||||
FullName = textBox1.Text,
|
{
|
||||||
GradeId = Convert.ToInt32(comboBox1.SelectedValue),
|
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));
|
var operationResult = (_id.HasValue ? _logicS.Update(model) : _logicS.Create(model));
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
{
|
{
|
||||||
|
@ -80,8 +80,11 @@ namespace SchoolScheduleDataBaseImplement.Models
|
|||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
foreach (var updateComponent in attendance)
|
foreach (var updateComponent in attendance)
|
||||||
{
|
{
|
||||||
|
updateComponent.Status = model.Attendance[updateComponent.LessonId].Item2;
|
||||||
|
updateComponent.Mark = model.Attendance[updateComponent.LessonId].Item3;
|
||||||
model.Attendance.Remove(updateComponent.LessonId);
|
model.Attendance.Remove(updateComponent.LessonId);
|
||||||
}
|
}
|
||||||
|
context.SaveChanges();
|
||||||
}
|
}
|
||||||
var student = context.Students.First(x => x.Id == Id);
|
var student = context.Students.First(x => x.Id == Id);
|
||||||
foreach (var pc in model.Attendance)
|
foreach (var pc in model.Attendance)
|
||||||
|
Loading…
Reference in New Issue
Block a user