示例#1
0
        public IActionResult DeleteLeaner(int id)
        {
            ViewData["Message"] = "Delete Leaner";

            StudentProcessor.DeleteLeaner(id);
            return(RedirectToAction(nameof(ViewLeaners)));
        }
示例#2
0
        public IActionResult AddModule(int id)
        {
            ViewData["Message"] = "Add Module To Leaner";

            var data = StudentProcessor.LoadModulesPerTrainee(id).ToList();
            List <Student_ModuleModel> modules = new List <Student_ModuleModel>();

            foreach (var row in data)
            {
                modules.Add(new Student_ModuleModel
                {
                    Id    = row.Id,
                    Title = row.Title
                });
            }
            ViewBag.listofitems = modules;

            var studentModule = StudentProcessor.GetTraineeModules(id).ToList();
            var GetStudent    = StudentProcessor.GetTrainee(id);

            ViewBag.listofModules = studentModule;

            StudentModel LeanerInfo = new StudentModel()
            {
                Id        = GetStudent[0].Id,
                FirstName = GetStudent[0].Firstname,
                LastName  = GetStudent[0].Lastname
            };

            TempData["Name"] = "" + LeanerInfo.FirstName + " " + LeanerInfo.LastName + "";

            return(View());
        }
        public IActionResult DeleteModule(int id)
        {
            ViewData["Message"] = "Delete Module";

            StudentProcessor.DeleteModule(id);
            return(RedirectToAction(nameof(ViewModules)));
        }
示例#4
0
        public IActionResult AddModule(int id, ModuleModel model)
        {
            StudentProcessor.AddModuleToStudent(id, Convert.ToInt32(model.Title));
            string url = $"../AddModule/{id}";

            return(Redirect(url));
        }
        static void Main(string[] args)
        {
            StudentProcessor p = new StudentProcessor();
            Student          s = p.GetStudentInfo();

            p.printStudentInfo(s);
        }
 public AccountController()
 {
     studentProcessor      = new StudentProcessor();
     classProcessor        = new ClassProcessor();
     studentClassProcessor = new StudentClassProcessor();
     sqlConnection         = System.Configuration.ConfigurationManager.ConnectionStrings["LocalPC"].ConnectionString;
 }
示例#7
0
 // POST api/values
 public bool DeleteStudent(Student student)
 {
     if (student == null)
     {
         return(false);
     }
     return(StudentProcessor.ProcessDeleteStudent(student));
 }
示例#8
0
        public IActionResult AddScore(Student_ModuleModel model)
        {
            ViewData["Message"] = "Add Score";
            StudentProcessor.AddScore(model.User_Id, model.Title_id, model.Score, DateTime.Now);
            string url = $"AddModule/{model.User_Id}";

            return(Redirect(url));
        }
 public IActionResult AddModule(ModuleModel model)
 {
     if (ModelState.IsValid)
     {
         StudentProcessor.CreateModule(model.Title, model.Language);
         return(RedirectToAction(nameof(ViewModules)));
     }
     return(View());
 }
示例#10
0
文件: Program.cs 项目: Nix7773/Dz2
        public static void ProcessStudents(IEnumerable <Student> Students, StudentProcessor Processor)
        {
            var index = 0;

            foreach (var s in Students)
            {
                Console.WriteLine(Processor(s, index++));
            }
        }
示例#11
0
        private static void ProcessStudent(IEnumerable <Student> Students, StudentProcessor Processor)
        {
            var index = 0;

            foreach (var student in Students)
            {
                Console.WriteLine(Processor(student, index++));
            }
        }
示例#12
0
 public IActionResult SignUp(StudentModel model)
 {
     if (ModelState.IsValid)
     {
         StudentProcessor.CreateLearner(model.FirstName, model.LastName);
         return(RedirectToAction(nameof(ViewLeaners)));
     }
     return(View());
 }
示例#13
0
        public ActionResult EditStudent(StudentModel model)
        {
            if (ModelState.IsValid)
            {
                int RecordUpdateded = StudentProcessor.UpdateStudent(model.Student_IDX, model.FirstName, model.LastName, model.Age, model.IsAlive);
                return(RedirectToAction("ViewStudents"));
            }

            return(View());
        }
示例#14
0
        public ActionResult DeleteStudent(int StudentID)
        {
            ViewBag.Message = "Delete Student";

            if (ModelState.IsValid)
            {
                int RecordDeleted = StudentProcessor.DeleteStudent(StudentID);
                return(RedirectToAction("ViewStudents"));
            }
            return(View());
        }
示例#15
0
        public IActionResult ViewLeaners()
        {
            ViewData["Message"] = "View Leaners";

            var data = StudentProcessor.LoadLeaners();
            List <StudentModel> learners = new List <StudentModel>();

            foreach (var row in data)
            {
                learners.Add(new StudentModel
                {
                    Id        = row.Id,
                    FirstName = row.Firstname,
                    LastName  = row.Lastname
                });
            }
            return(View(learners));
        }
        public IActionResult ViewModules()
        {
            ViewData["Message"] = "View Modules";

            var data = StudentProcessor.LoadModules();
            List <ModuleModel> modules = new List <ModuleModel>();

            foreach (var row in data)
            {
                modules.Add(new ModuleModel
                {
                    Id       = row.Id,
                    Title    = row.Title,
                    Language = row.Language
                });
            }

            return(View(modules));
        }
示例#17
0
        public ActionResult ViewStudents()
        {
            ViewBag.Message = "Student List";

            var data = StudentProcessor.LoadStudents();
            List <StudentModel> students = new List <StudentModel>();

            foreach (var row in data)
            {
                students.Add(new StudentModel
                {
                    Student_IDX = row.Student_IDX,
                    FirstName   = row.FirstName,
                    LastName    = row.LastName,
                    Age         = row.Age,
                    IsAlive     = row.IsAlive
                });
            }
            return(View(students));
        }
        public IActionResult ScoresReport()
        {
            ViewData["Message"] = "Report Scores";


            var data = StudentProcessor.ReportScores();
            List <Scores_reportModel> Scores = new List <Scores_reportModel>();

            foreach (var row in data)
            {
                Scores.Add(new Scores_reportModel
                {
                    Trainee_id = row.Trainee_id,
                    FirstName  = row.FirstName,
                    LastName   = row.LastName,
                    Year       = row.Year,
                    Scores     = row.Scores
                });
            }

            return(View(Scores));
        }
示例#19
0
        public ActionResult ViewStudent(int StudentID)
        {
            ViewBag.Message = "Student Detail";
            var data = StudentProcessor.LoadStudents();
            List <StudentModel> students = new List <StudentModel>();

            foreach (var row in data)
            {
                students.Add(new StudentModel
                {
                    Student_IDX = row.Student_IDX,
                    FirstName   = row.FirstName,
                    LastName    = row.LastName,
                    Age         = row.Age,
                    IsAlive     = row.IsAlive
                });
            }


            var student = students.Where(s => s.Student_IDX == StudentID).FirstOrDefault();

            return(View(student));
        }