示例#1
0
        public ActionResult Create([Bind(Include = "Id,SchoolName,RegNo")] School school)
        {
            if (ModelState.IsValid)
            {
                db.Schools.Add(school);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(school));
        }
示例#2
0
        public ActionResult Create([Bind(Include = "Id,StreamName")] Stream stream)
        {
            if (ModelState.IsValid)
            {
                db.Streams.Add(stream);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            return(View(stream));
        }
示例#3
0
        public ActionResult Create([Bind(Include = "Id,TeacherNo,SchoolId,EnlistedDate")] Teacher teacher)
        {
            if (ModelState.IsValid)
            {
                db.Teachers.Add(teacher);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(teacher));
        }
示例#4
0
        public ActionResult Create([Bind(Include = "Id,Type")] ExamType examType)
        {
            if (ModelState.IsValid)
            {
                db.ExamTypes.Add(examType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(examType));
        }
示例#5
0
        public ActionResult Create([Bind(Include = "Id,FirstName,MiddleName,LastName,DateOfBirth,Gender,MaritalStatus,CreatedBy,CreatedDate,EditedBy,EditedDate")] Parent parent)
        {
            if (ModelState.IsValid)
            {
                db.Parents.Add(parent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(parent));
        }
示例#6
0
        public ActionResult Create([Bind(Include = "Id,StudentId")] Attendence attendence)
        {
            if (ModelState.IsValid)
            {
                db.Attendences.Add(attendence);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.StudentId = new SelectList(db.Students, "Id", "AdmissionNo", attendence.StudentId);
            return(View(attendence));
        }
示例#7
0
        public ActionResult Create([Bind(Include = "Id,DomitoryName,DomitoryNo,SchoolId")] Domitory domitory)
        {
            if (ModelState.IsValid)
            {
                db.Domitories.Add(domitory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SchoolId = new SelectList(db.Schools, "Id", "SchoolName", domitory.SchoolId);
            return(View(domitory));
        }
示例#8
0
        public ActionResult Create([Bind(Include = "Id,EmployeeId,TeacherId")] Leave leave)
        {
            if (ModelState.IsValid)
            {
                db.Leaves.Add(leave);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "EmployNumber", leave.EmployeeId);
            return(View(leave));
        }
示例#9
0
        public ActionResult Create([Bind(Include = "Id,ClassName,SchoolId")] Class @class)
        {
            if (ModelState.IsValid)
            {
                db.Classes.Add(@class);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SchoolId = new SelectList(db.Schools, "Id", "SchoolName", @class.SchoolId);
            return(View(@class));
        }
示例#10
0
        public ActionResult Create([Bind(Include = "Id,EmployNumber,SchoolId,EnlistedDate")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SchoolId = new SelectList(db.Schools, "Id", "SchoolName", employee.SchoolId);
            return(View(employee));
        }
示例#11
0
        public ActionResult Create([Bind(Include = "Id,ExamName,ExamType,SubjectId")] Exam exam)
        {
            if (ModelState.IsValid)
            {
                db.Exams.Add(exam);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SubjectId = new SelectList(db.Subjects, "Id", "Name", exam.SubjectId);
            return(View(exam));
        }
示例#12
0
        public ActionResult Create([Bind(Include = "Id,Day,StartTime,EndTime,SubjectId")] TimeTable timeTable)
        {
            if (ModelState.IsValid)
            {
                db.TimeTables.Add(timeTable);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SubjectId = new SelectList(db.Subjects, "Id", "Name", timeTable.SubjectId);
            return(View(timeTable));
        }
示例#13
0
        public ActionResult Create([Bind(Include = "Id,AdmissionNo,SchoolId,ClassId,ParentId,FirstName,MiddleName,LastName,DateOfBirth,Gender,MaritalStatus,CreatedBy,CreatedDate,EditedBy,EditedDate")] Student student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClassId  = new SelectList(db.Classes, "Id", "ClassName", student.ClassId);
            ViewBag.ParentId = new SelectList(db.Parents, "Id", "FirstName", student.ParentId);
            return(View(student));
        }
示例#14
0
        public ActionResult Create([Bind(Include = "Id,Name,StudentId,TeacherId")] Subject subject)
        {
            if (ModelState.IsValid)
            {
                db.Subjects.Add(subject);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.StudentId = new SelectList(db.Students, "Id", "AdmissionNo", subject.StudentId);
            ViewBag.TeacherId = new SelectList(db.Teachers, "Id", "TeacherNo", subject.TeacherId);
            return(View(subject));
        }
示例#15
0
        public ActionResult Create([Bind(Include = "Id,ClassName,SchoolId")] ClassViewModel classViewModel)
        {
            if (ModelState.IsValid)
            {
                var klas = new  Class()
                {
                    //mapping
                    ClassName = classViewModel.ClassName,
                    SchoolId  = classViewModel.SchoolId
                };

                db.Classes.Add(klas);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SchoolId = new SelectList(db.Schools, "Id", "SchoolName", classViewModel.SchoolId);
            return(View(classViewModel));
        }