Exemple #1
0
        // GET: Page/Create
        public IActionResult Create()
        {
            var model = new PageViewModel
            {
                Page           = null,
                Sections       = _sectionService.GetAll().ToList(),
                ActiveSections = _sectionService.GetAllSectionsForPageWithFlag(null),
                IsInMenu       = true
            };

            return(View(model));
        }
Exemple #2
0
        // GET: Feedback/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserTask userTask = userTaskService.GetAll().Where(x => x.ID == id).FirstOrDefault();

            if (userTask == null)
            {
                return(HttpNotFound());
            }
            var task = taskService.Get(userTask.TaskID);
            ExtentionTaskViewModel model = new ExtentionTaskViewModel
            {
                ID        = userTask.ID,
                Answer    = userTask.Answer,
                Comment   = userTask.Comment,
                Grade     = userTask.Grade,
                Task      = task,
                Section   = task.Section,
                User      = userService.Get(userTask.UserID),
                SectionID = task.Section.ID,
                TaskID    = task.ID,
                UserID    = userTask.UserID
            };

            ViewBag.SectionID = new SelectList(sectionService.GetAll(), "ID", "Description", model.Section.ID);
            if (model.Grade != null)
            {
                ViewBag.Grade = new SelectList(new List <string>()
                {
                    "Отлично",
                    "Хорошо",
                    "Удовлетворительно",
                    "Неудовлетворительно"
                }, model.Grade);
            }
            else
            {
                ViewBag.Grade = new SelectList(new List <string>()
                {
                    "Отлично",
                    "Хорошо",
                    "Удовлетворительно",
                    "Неудовлетворительно"
                }, "ID");
            }
            return(View(model));
        }
        private IEnumerable <SelectListItem> GetCategories()
        {
            var sections = _sectionService.GetAll();
            var skills   = _skillService.GetAll();

            var groups = (from se in sections
                          select new SelectListGroup()
            {
                Name = se.Title
            }).ToList();

            var skillsWithSections = (from se in sections
                                      join sk in skills on se.Id equals sk.SectionId
                                      select new
            {
                Id = sk.Id,
                Title = sk.Title,
                SectionTitle = se.Title
            }).ToList();

            var groupData = (from sk in skillsWithSections
                             select new SelectListItem()
            {
                Value = sk.Id.ToString(),
                Text = sk.Title,
                Group = groups.First(sec => sec.Name.Equals(sk.SectionTitle))
            }).ToList();

            return(groupData);
        }
        public HttpResponseMessage Index()
        {
            ItemsResponse <Section> response = new ItemsResponse <Section>();

            response.Items = _sectionService.GetAll();

            return(Request.CreateResponse(response));
        }
        public void Update_UpdatingSection_ShouldUpdateSection()
        {
            // Arrange

            var entity = new Section
            {
                Name = "Test"
            };

            _db.Sections.Add(entity);
            _db.SaveChanges();
            var before = _db.Sections.Count();

            // Act
            entity      = _service.GetAll().FirstOrDefault();
            entity.Name = "Another name";
            _service.Update(entity);
            _db.SaveChanges();

            // Assert
            Assert.Equal(before, _db.Sections.Count());
            Assert.Equal("Another name", _db.Sections.FirstOrDefault().Name);
        }
        // GET: Course
        public ActionResult Index()
        {
            var identity = (ClaimsIdentity)User.Identity;
            var id       = identity.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier).Value;
            var user     = userService.Get(int.Parse(id));
            List <GroupSection> groupSections = new List <GroupSection>();

            if (user.GroupID != null)
            {
                groupSections.AddRange(groupSectionService.GetAll().Where(x => x.GroupID == user.GroupID));
            }
            //Section by group
            List <Section> sections = new List <Section>();
            List <Course>  courses  = new List <Course>();

            foreach (var item in sectionService.GetAll())
            {
                for (int i = 0; i < groupSections.Count; i++)
                {
                    if (item.ID == groupSections[i].SectionID)
                    {
                        sections.Add(item);
                        groupSections.Remove(groupSections[i]);
                    }
                }
            }
            foreach (var item in sections)
            {
                courses.AddRange(item.Courses);
            }
            //foreach (var item in courseService.GetAll())
            //{
            //    for (int i = 0; i < sections.Count; i++)
            //    {
            //        if (item.SectionID == sections[i].ID)
            //        {
            //            courses.Add(item);
            //            sections.Remove(sections[i]);
            //        }
            //    }
            //}
            return(View(courses));
        }
        public ActionResult Index()
        {
            TestVM quiz     = new TestVM();
            var    identity = (ClaimsIdentity)User.Identity;
            var    id       = identity.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier).Value;
            var    user     = userService.Get(int.Parse(id));
            List <GroupSection> groupSections = new List <GroupSection>();

            if (user.GroupID != null)
            {
                groupSections.AddRange(groupSectionService.GetAll().Where(x => x.GroupID == user.GroupID));
            }
            //Section by group
            List <Section> sections = new List <Section>();

            foreach (var item in sectionService.GetAll())
            {
                for (int i = 0; i < groupSections.Count; i++)
                {
                    if (item.ID == groupSections[i].SectionID)
                    {
                        sections.Add(item);
                        groupSections.Remove(groupSections[i]);
                    }
                }
            }
            //TODO
            List <Test> tests = new List <Test>();

            foreach (var item in sections)
            {
                foreach (var test in item.Tests)
                {
                    var grade = user.Grades.Where(x => x.TestID == test.ID).FirstOrDefault();
                    if (grade == null)
                    {
                        tests.Add(test);
                    }
                }
            }

            quiz.Questions = tests.Select(q => new SelectListItem
            {
                Text  = q.Title,
                Value = q.ID.ToString()
            }).ToList();

            return(View(quiz));
        }
Exemple #8
0
        public IList <Core.Dto.Section> Get()
        {
            IList <Core.Dto.Section> sections = _sectionService.GetAll();

            return(sections);
        }
        public IEnumerable <SectionDTO> GetSections()
        {
            var sections = _sectionService.GetAll();

            return(sections);
        }
Exemple #10
0
 // GET: Courses/Create
 public ActionResult Create()
 {
     ViewBag.SectionID = new SelectList(sectionService.GetAll(), "ID", "Description");
     return(View());
 }
 // GET: CoursesController/Create
 public ActionResult Create()
 {
     ViewData["SectionId"] = new SelectList(sectionService.GetAll(),
                                            "SectionId", "Name");
     return(View());
 }
Exemple #12
0
 public IActionResult Sections()
 {
     return(View(sectionService.GetAll()));
 }
Exemple #13
0
        public APIResponseViewModel GetAllSections(int Page)
        {
            var Sections = _SectionService.GetAll(Page);

            return(GetRespons(Sections, "Data Retrive Sucess"));
        }
Exemple #14
0
 public ActionResult Index()
 {
     return(View(sectionService.GetAll()));
 }
Exemple #15
0
 public IEnumerable <SectionModel> GetAll()
 {
     return(_service.GetAll());
 }
Exemple #16
0
        public IActionResult GetAll(int pageNum)
        {
            var result = _SectionService.GetAll(pageNum);

            return(Ok(GetResponse("Done", result)));
        }
Exemple #17
0
        public ActionResult Index()
        {
            var sections = _sectionService.GetAll();

            return(View(sections));
        }
 public ActionResult Create()
 {
     ViewBag.Students = userService.GetAll().Where(x => x.GroupID == null && x.Role.Value.Equals("Студент")).ToList();
     ViewBag.Sections = sectionService.GetAll().ToList();
     return(View());
 }