Пример #1
0
 //Teacher Controller
 public int SaveTest(TestDTO t_dto)
 {
     using (var ctx = new MyDBContext())
     {
         ctx.Test.Add(t_dto);
         ctx.SaveChanges();
         return(t_dto.TestID);
     }
 }
Пример #2
0
        public void SaveStudentQuiz(TestDTO t_dto)
        {
            using (var ctx = new MyDBContext())
            {
                var usrs = ctx.Users.Where(c => c.Username.StartsWith(t_dto.Section)).ToList();

                QuizesDTO q_dto = new QuizesDTO();
                foreach (var q in usrs)
                {
                    q_dto.TestID        = t_dto.TestID;
                    q_dto.UserID        = q.UserID;
                    q_dto.UserName      = q.Username;
                    q_dto.TotalMarks    = t_dto.TotalMarks;
                    q_dto.MarksObtained = 0;
                    q_dto.isTaken       = false;
                    q_dto.ConductDate   = null;

                    ctx.Quizes.Add(q_dto);
                    ctx.SaveChanges();
                }
            }
        }
Пример #3
0
        public void SaveStudentsQuiz(TestDTO t_dto)
        {
            MyDBService ser = new MyDBService();

            ser.SaveStudentQuiz(t_dto);
        }
Пример #4
0
        public int SaveTest(TestDTO t_dto)
        {
            MyDBService ser = new MyDBService();

            return(ser.SaveTest(t_dto));
        }