Exemplo n.º 1
0
        public ActionResult Index([Bind(Include = "authorized_person_email, authorized_person_password")] Authorized_Persons form_datas)
        {
            Authorized_Persons check_authorized_person = db.Authorized_Persons.Where(a => a.authorized_person_email == form_datas.authorized_person_email).FirstOrDefault();

            if (check_authorized_person == null)
            {
                ViewBag.LoginError = "Email düzgün daxil edilməyib!";
                return(View());
            }

            //Input'dan daxil edilən şifrəni VerifyPassword methodu ilə check edir. (Ətraflı: BaseController-Abstract.cs)
            if (!PasswordStorage.VerifyPassword(form_datas.authorized_person_password, check_authorized_person.authorized_person_password))
            {
                ViewBag.LoginError = "Şifrə düzgün daxil edilməyib!";
                return(View());
            }

            User_Roles role = db.User_Roles.Where(r => r.user_role_id == check_authorized_person.authorized_person_role_id).FirstOrDefault();

            //Normalda bu üsulla user authorization etmək düzgün deyil.
            //Lakin layihə üçün verilən vaxt müddəti az olduğundan dərinliyinə getmirəm.
            if (role.user_role_name == "Rektor" || role.user_role_name == "Prorektor" || role.user_role_name == "Rektor Müşaviri" || role.user_role_name == "Dekan" || role.user_role_name == "Kafedra Müdiri" || role.user_role_name == "Mərkəz Rəhbəri" || role.user_role_name == "Muzey Rəhbəri")
            {
                Session["Authorized_Person_Id"]       = check_authorized_person.authorized_person_id;
                Session["Authorized_Person_Email"]    = check_authorized_person.authorized_person_email;
                Session["Authorized_Person_Password"] = check_authorized_person.authorized_person_password;
                AreaName = "Admin";
            }

            return(RedirectToAction("Index", "Dashboard", new { Area = AreaName }));
        }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Authorized_Persons authorized_Persons = db.Authorized_Persons.Find(id);

            db.Authorized_Persons.Remove(authorized_Persons);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "authorized_person_id,authorized_person_name,authorized_person_surname,authorized_person_father_name,authorized_person_email,authorized_person_password,authorized_person_role_id,authorized_person_degree_id,authorized_person_gender_id")] Authorized_Persons authorized_Persons)
 {
     if (ModelState.IsValid)
     {
         authorized_Persons.authorized_person_password = PasswordStorage.CreateHash(authorized_Persons.authorized_person_password);
         db.Entry(authorized_Persons).State            = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.authorized_person_degree_id = new SelectList(db.Degrees, "degree_id", "degree_name", authorized_Persons.authorized_person_degree_id);
     ViewBag.authorized_person_gender_id = new SelectList(db.Genders, "gender_id", "gender_name", authorized_Persons.authorized_person_gender_id);
     ViewBag.authorized_person_role_id   = new SelectList(db.User_Roles, "user_role_id", "user_role_name", authorized_Persons.authorized_person_role_id);
     return(View(authorized_Persons));
 }
Exemplo n.º 4
0
        // GET: Admin/Authorized_Persons/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Authorized_Persons authorized_Persons = db.Authorized_Persons.Find(id);

            if (authorized_Persons == null)
            {
                return(HttpNotFound());
            }
            return(View(authorized_Persons));
        }
Exemplo n.º 5
0
        // GET: Admin/Authorized_Persons/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Authorized_Persons authorized_Persons = db.Authorized_Persons.Find(id);

            if (authorized_Persons == null)
            {
                return(HttpNotFound());
            }
            ViewBag.authorized_person_degree_id = new SelectList(db.Degrees, "degree_id", "degree_name", authorized_Persons.authorized_person_degree_id);
            ViewBag.authorized_person_gender_id = new SelectList(db.Genders, "gender_id", "gender_name", authorized_Persons.authorized_person_gender_id);
            ViewBag.authorized_person_role_id   = new SelectList(db.User_Roles, "user_role_id", "user_role_name", authorized_Persons.authorized_person_role_id);
            return(View(authorized_Persons));
        }