public ActionResult Index([Bind(Include = "teacher_email, teacher_password")] Teachers teacher_login_form) { Teachers check_teacher_email = db.Teachers.Where(t => t.teacher_email == teacher_login_form.teacher_email).FirstOrDefault(); if (check_teacher_email == null) { ViewBag.LoginError = "Email düzgün daxil edilməyib!"; return(View()); } if (!PasswordStorage.VerifyPassword(teacher_login_form.teacher_password, check_teacher_email.teacher_password)) { ViewBag.LoginError = "Şifrə düzgün daxil edilməyib!"; return(View()); } if (Convert.ToBoolean(check_teacher_email.teacher_first_login)) { Session["FirstLogin_Email"] = check_teacher_email.teacher_email; Session["FirstLogin_Id"] = check_teacher_email.teacher_id.ToString(); return(RedirectToAction("SetNewPassword", "Login")); } Role_Types teacher_role = db.Role_Types.Where(r => r.role_types_id == check_teacher_email.teacher_role_types_id).FirstOrDefault(); if (teacher_role.role_types_name == "Admin") { Session["LoggedAdminId"] = check_teacher_email.teacher_id; Session["LoggedAdminEmail"] = check_teacher_email.teacher_email; Session["LoggedAdminPassword"] = check_teacher_email.teacher_password; AreaName = "Adminpanel"; } else if (teacher_role.role_types_name == "Müəllim") { Session["LoggedTeacherId"] = check_teacher_email.teacher_id; Session["LoggedTeacherEmail"] = check_teacher_email.teacher_email; Session["LoggedTeacherPassword"] = check_teacher_email.teacher_password; AreaName = "Teacher"; } //Class'ın hansı məqsədlə istifadə olunduğunu SetGroupsStatusByDate.cs faylında yazmışam. SetGroupsStatusByDate test = new SetGroupsStatusByDate(); test.Run(); return(RedirectToAction("Index", "Dashboard", new { Area = AreaName })); }
public ActionResult Edit([Bind(Include = "group_id,group_name,group_start_date,group_end_date,group_lesson_times_id,group_teacher_id,group_group_type_id,group_status")] Groups groups) { if (ModelState.IsValid) { db.Entry(groups).State = EntityState.Modified; groups.group_status = true; db.SaveChanges(); //Class'ın hansı məqsədlə istifadə olunduğunu SetGroupsStatusByDate.cs faylında yazmışam. SetGroupsStatusByDate test = new SetGroupsStatusByDate(); test.Run(); return(RedirectToAction("Index")); } ViewBag.group_group_type_id = new SelectList(db.Group_Types, "group_types_id", "group_types_name", groups.group_group_type_id); ViewBag.group_lesson_times_id = new SelectList(db.Lesson_Times, "lesson_times_id", "lesson_times_name", groups.group_lesson_times_id); ViewBag.group_teacher_id = new SelectList(db.Teachers, "teacher_id", "teacher_email", groups.group_teacher_id); return(View(groups)); }