Esempio n. 1
0
        // GET: /Teacher/DeleteConfirm/{id}
        public ActionResult DeleteConfirm(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher NewTeacher = controller.FindTeacher(id);

            return(View(NewTeacher));
        }
Esempio n. 2
0
        // GET: /Teacher/List
        public ActionResult List(string Searchkey = null)
        {
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> Teachers   = controller.ListTeachers(Searchkey);

            return(View(Teachers));
        }
Esempio n. 3
0
        // POST: /Teacher/Delete/{id}
        public ActionResult Delete(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);
            // When a teacher data is deleted, redirect to List page
            return(RedirectToAction("List"));
        }
Esempio n. 4
0
        public ActionResult Create(string TeacherFname, string TeacherLname, string EmployeeNumber,
                                   DateTime HireDate, decimal Salary)
        {
            //Identify that this method is running
            //Identify the inputs provided from the form

            Debug.WriteLine(TeacherFname);
            Debug.WriteLine(TeacherLname);
            Debug.WriteLine(EmployeeNumber);
            Debug.WriteLine(HireDate);
            Debug.WriteLine(Salary);


            // if (TeacherFname == null || TeacherFname == "" || !Regex.IsMatch(TeacherFname, @"[a-zA-Z]"))
            //{
            //ViewBag.FnameError = "Please input valid first name";
            //Debug.WriteLine("Here");
            ///return RedirectToAction("New");

            //}

            //else
            //{

            Teacher NewTeacher = new Teacher();

            NewTeacher.TeacherFname   = TeacherFname;
            NewTeacher.TeacherLname   = TeacherLname;
            NewTeacher.EmployeeNumber = EmployeeNumber;
            NewTeacher.HireDate       = HireDate;
            NewTeacher.Salary         = Salary;

            TeacherDataController controller = new TeacherDataController();

            controller.AddTeacher(NewTeacher);

            //When new data is created, redirect to List page
            return(RedirectToAction("List"));
            //}
        }