public ActionResult Edit(EducationGroup educationGroup, int[] studentId, int[] notStudentId) { if (educationGroup.Id > 0) { if (studentId != null) { for (int i = 0; i < studentId.Length; i++) { _student = _stuBLL.Get(studentId[i]); _student.EducationGrouoStatus = false; _stuBLL.Update(_student); } } if (notStudentId != null) { for (int i = 0; i < notStudentId.Length; i++) { educationGroup.TrainerID = (int)Session["LoginID"]; _eduGroupStu = new Education_Group_Student(); _eduGroupStu.StudentID = notStudentId[i]; _eduGroupStu.EducationGroupID = educationGroup.Id; _student = _stuBLL.Get(notStudentId[i]); _eduGroupStu.DateOfJoin = DateTime.Now; _student.EducationGrouoStatus = true; _stuBLL.Update(_student); _educationGroupStuBLL.Add(_eduGroupStu); } } educationGroup.TrainerID = (int)Session["LoginID"]; _educationGroupBLL.Update(educationGroup); TempData["ResultMessage"] = "Yaptığınız Değişiklikler Başarıyla Gerçekleşmiştir."; } else { educationGroup.DateOfCreation = DateTime.Now.Date; educationGroup.TrainerID = (int)Session["LoginID"]; _educationGroupBLL.Add(educationGroup); for (int i = 0; i < studentId.Length; i++) { _eduGroupStu = new Education_Group_Student(); _eduGroupStu.DateOfJoin = DateTime.Now.Date; _eduGroupStu.EducationGroupID = educationGroup.Id; _eduGroupStu.StudentID = studentId[i]; _student = _stuBLL.Get(studentId[i]); _student.EducationGrouoStatus = true; _stuBLL.Update(_student); _educationGroupStuBLL.Add(_eduGroupStu); } } TempData["ResultMessage"] = "Kaydetme İşleminiz Başarıyla Gerçekleşmiştir."; return(RedirectToAction("Index")); }
public void EducationStudentAdd(Education_Group_Student _eduGroupStu) { _uow.EducationGroupStudentRepository.Add(_eduGroupStu); _uow.ApplyChanges(); }