Пример #1
0
        public IActionResult AdminInformationAdd(User model)
        {
            if (HttpContext.Session.Get("userName") != null && accountType().Equals("Manager"))
            {
                //showing user name on admin pannel
                UserNameOnAdminPanel();

                User adminModel = new User
                {
                    FirstName   = model.FirstName,
                    LastName    = model.LastName,
                    Email       = model.Email,
                    Password    = model.Password,
                    AccountType = model.AccountType
                };

                _Context.Users.Add(adminModel);
                _Context.SaveChanges();

                return(RedirectToAction("Admins"));
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }
        }
Пример #2
0
        public IActionResult Admission(Admission model)
        {
            if (HttpContext.Session.Get("userName") != null && accountType().Equals("AdmissionOfficer"))
            {
                //showing user name on admin pannel
                UserNameOnAdminPanel();

                Admission admit = new Models.Admission()
                {
                    FormNo                    = model.FormNo,
                    StudentId                 = model.StudentId,
                    ClassName                 = model.ClassName,
                    Section                   = model.Section,
                    StudentNameBangla         = model.StudentNameBangla,
                    StudentNameEnglish        = model.StudentNameEnglish,
                    FatherName                = model.FatherName,
                    FatherNID                 = model.FatherNID,
                    FatherMobile              = model.FatherMobile,
                    FatherDOB                 = model.FatherDOB,
                    PaternalGrandFatherName   = model.PaternalGrandFatherName,
                    PaternalGrandMotherName   = model.PaternalGrandMotherName,
                    MotherName                = model.MotherName,
                    MotherNID                 = model.MotherNID,
                    MotherMobile              = model.MotherMobile,
                    MotherDOB                 = model.MotherDOB,
                    MaternalGrandFatherName   = model.MaternalGrandFatherName,
                    MaternalGrandMotherName   = model.MaternalGrandMotherName,
                    StudentDOB                = model.StudentDOB,
                    StudentBirthCertificateNo = model.StudentBirthCertificateNo,
                    PermanentVillage          = model.PermanentVillage,
                    PermanentPost             = model.PermanentPost,
                    PermanentPostCode         = model.PermanentPostCode,
                    PermanentSubDistrict      = model.PermanentSubDistrict,
                    PermanentDistrict         = model.PermanentDistrict,
                    PresentVillage            = model.PresentVillage,
                    PresentPost               = model.PresentPost,
                    PresentPostCode           = model.PresentPostCode,
                    PresentSubDistrict        = model.PresentSubDistrict,
                    PresentDistrict           = model.PresentDistrict,
                    HomeOwnerName             = model.HomeOwnerName,
                    HomeOwnerMobile           = model.HomeOwnerMobile,
                };

                _Context.Students.Add(admit);
                _Context.SaveChanges();
                return(RedirectToAction("Admission"));
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }
        }
        public IActionResult StudentResultIndividualUpdate(RelResult model)
        {
            if (HttpContext.Session.Get("userName") != null && accountType().Equals("ResultOfficer"))
            {
                //showing user name on admin pannel
                UserNameOnAdminPanel();
                var availableResult = _Context.RelResults.Where(u => u.student_id == model.student_id && u.exam_type == model.exam_type && u.subject_name == model.subject_name).FirstOrDefault();
                if (availableResult != null)
                {
                    _Context.RelResults.Remove(availableResult);
                    _Context.SaveChanges();

                    RelResult admit = new Models.RelResult()
                    {
                        student_id   = model.student_id,
                        class_name   = model.class_name,
                        section      = model.section,
                        exam_type    = model.exam_type,
                        subject_name = model.subject_name,
                        marks        = model.marks
                    };

                    _Context.RelResults.Update(admit);
                    _Context.SaveChanges();
                }
                else
                {
                    RelResult admit = new Models.RelResult()
                    {
                        student_id   = model.student_id,
                        class_name   = model.class_name,
                        section      = model.section,
                        exam_type    = model.exam_type,
                        subject_name = model.subject_name,
                        marks        = model.marks
                    };

                    _Context.RelResults.Add(admit);
                    _Context.SaveChanges();
                }

                return(RedirectToAction("StudentResultIndividualUpdate", new { StudentId = model.student_id, ClassName = model.class_name, exam_type = model.exam_type, sectionName = model.section }));
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }
        }
Пример #4
0
        // Subject Add
        public IActionResult SubjectAdd(string SubjectNameAdd, string className)
        {
            if (HttpContext.Session.Get("userName") != null && accountType().Equals("Manager"))
            {
                //showing user name on admin pannel
                UserNameOnAdminPanel();

                RelClassSubject subjectModel = new RelClassSubject
                {
                    class_name   = className,
                    subject_name = SubjectNameAdd
                };

                _Context.RelClassSubjects.Add(subjectModel);
                _Context.SaveChanges();

                return(RedirectToAction("RelClasses", new { className = className }));
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }
        }
Пример #5
0
        // Manager edit -> Class - update
        public IActionResult ClassUpdate(Class model, string classNameUpdate)
        {
            if (HttpContext.Session.Get("userName") != null && accountType().Equals("Manager"))
            {
                //showing user name on admin pannel
                UserNameOnAdminPanel();
                var classes = _Context.Classes.Where(u => u.class_name == model.class_name).FirstOrDefault();
                _Context.Classes.Remove(classes);
                _Context.SaveChanges();

                Class classModel = new Class
                {
                    class_name = classNameUpdate
                };
                _Context.Classes.Update(classModel);
                _Context.SaveChanges();

                return(RedirectToAction("Classs"));
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }
        }