コード例 #1
0
ファイル: HomeController.cs プロジェクト: SergeyGoubev/Copy
        //Стартовая страница
        public ActionResult Index()
        {
            if (User.IsInRole("Student"))
            {
                int id = sDAO.getStudentId(User.Identity.Name);
                Console.WriteLine(id);
                VKR vkr = vDAO.getVKRbyStudent(id);
                ViewAnswerAndVKR vav     = new ViewAnswerAndVKR(vkr, id);
                List <Answer>    answers = aDAO.getAnswersByVKR(vkr.id);
                vav.answers = answers;
                return(View(vav));
            }
            else if (User.IsInRole("Teacher"))
            {
                int id = tDAO.getTeacherId(User.Identity.Name);
                ViewAnswerAndVKR vav = new ViewAnswerAndVKR(aDAO.getLastAnswers(id), id);
                return(View(vav));
            }
            else

            if (User.IsInRole("Decan"))
            {
                List <Plan>      plans    = pDAO.showPlansByStatus(6);
                ViewAnswerAndVKR vav      = new ViewAnswerAndVKR(plans);
                List <Kafedra>   kafedras = kDAO.getAllKafedras();
                vav.kafedras = kafedras;
                return(View(vav));
            }
            else
            {
                if (User.IsInRole("Leiter"))
                {
                    List <Kafedra>   kafedras = kDAO.getAllKafedras();
                    ViewAnswerAndVKR vav      = new ViewAnswerAndVKR(kafedras);
                    aDAO.checkAllAnswers();
                    return(View(vav));
                }
                else
                {
                    return(View());
                }
            }
        }