public JsonResult DeleteLesson(int?value) { if (value != null) { Lessons lesson = lessonManager.Find(x => x.id == value); if (lesson != null) { int count = lessonManager.Remove(lesson); if (count > 0) { _IRedisCacheService.GetAllRemove(); toastNotification.AddSuccessToastMessage("Silme İşlemi Başarılı!"); return(Json(new { state = true })); } toastNotification.AddWarningToastMessage("Silme İşlemi Sırasında Bir Hata Meydana Geldi!!"); return(Json(new { state = false })); } toastNotification.AddWarningToastMessage("Silme İşlemi Sırasında Bir Hata Meydana Geldi!!"); return(Json(new { state = false })); } toastNotification.AddWarningToastMessage("Silme İşlemi Sırasında Bir Hata Meydana Geldi!!"); return(Json(new { state = false })); }
public IActionResult EditInstructor(int id) { Teacher teacher = ınstructorManager.Find(x => x.id == id); int empty = 0; int leave = -1; List <Branch_Teacher> instructorBrachList = branch_TeacherManager.List(x => x.teacherid == id); for (int i = 0; i < instructorBrachList.Count; i++) { List <SelectListItem> branchlist = new List <SelectListItem>(); List <SelectListItem> lessonlist = new List <SelectListItem>(); branchlist.Add(new SelectListItem(instructorBrachList[i].branchName, instructorBrachList[i].branchid.ToString())); branchlist.Add(new SelectListItem("Branşı Bırak", leave.ToString())); Lessons lesson = lessonManager.Find(x => x.ownerBranch.Equals(instructorBrachList[i].branchName) && x.teacherid == instructorBrachList[i].teacherid); if (lesson != null) { lessonlist.Add(new SelectListItem(lesson.name, lesson.id.ToString())); } else { lessonlist.Add(new SelectListItem("Ders Seçilmedi", empty.ToString())); } editInstructorViewModel.branchKeys.Add(branchlist); editInstructorViewModel.lessonKeys.Add(lessonlist); } editInstructorViewModel.name = teacher.name; editInstructorViewModel.surname = teacher.surname; editInstructorViewModel.branchValues = new int[instructorBrachList.Count]; editInstructorViewModel.lessonValues = new int[instructorBrachList.Count]; editInstructorViewModel.Id = id; return(View(editInstructorViewModel)); }