public void ClassesSelect()
        {
            ClassRepository repo = new ClassRepository(new ClassSQLContext());
            List <Class>    c    = repo.GetAll();

            Assert.IsNotNull(c, "Classes weren't correctly retrieved");
        }
        public ActionResult List()
        {
            // Get all the classes of the logged in counseler.
            var classes = Mapper.Map <List <ClassModel> >(_classRepository.GetAll().Where(c => c.CounselerId == Counseler.Id));

            return(View(classes));
        }
Esempio n. 3
0
        public ActionResult Classes(int id)
        {
            ViewBag.Classes = new SelectList(classRepository.GetAll(), "Id", "Name");

            var map = new MapperConfiguration(c => c.CreateMap <SchoolClassDTO, SchoolClassViewModel>()).CreateMapper();

            return(View(map.Map <IEnumerable <SchoolClassDTO>, IEnumerable <SchoolClassViewModel> >(teacherService.GetTeacherClasses(id))));
        }
Esempio n. 4
0
        public ActionResult Index(int?schoolclass, string sex)
        {
            var maper = new MapperConfiguration(c => c.CreateMap <SchoolClassDTO, SchoolClassViewModel>()).CreateMapper();

            var classes = maper.Map <IEnumerable <SchoolClassDTO>, List <SchoolClassViewModel> >(classRepository.GetAll());

            classes.Insert(0, new SchoolClassViewModel {
                Id = 0, Name = "Все"
            });


            ViewBag.Classes = new SelectList(classes, "Id", "Name");

            var map = new MapperConfiguration(c => c.CreateMap <StudentDTO, StudentViewModel>()).CreateMapper();

            return(View(map.Map <IEnumerable <StudentDTO>, IEnumerable <StudentViewModel> >(studentService.Search(schoolclass, sex))));
        }
 private void PrepareStudentModel(StudentModel model)
 {
     // Create a select list of classes.
     model.ClassesList = SelectList(_classRepository.GetAll(),
                                    c => c.Id,
                                    c => c.Name + (!string.IsNullOrEmpty(c.Section)
                            ? string.Format(" ({0})", c.Section)
                            : string.Empty));
 }
 private void PrepareSubjectModel(SubjectModel model)
 {
     // Create a select list for the classes.
     model.ClassesList = SelectList(_classRepository.GetAll().Where(c => c.CounselerId == Counseler.Id),
                                    c => c.Id,
                                    c => c.Name + (!string.IsNullOrEmpty(c.Section)
                            ? string.Format(" ({0})", c.Section)
                            : string.Empty));
 }
Esempio n. 7
0
        public IHttpActionResult GetAllClasses()
        {
            var classes = classRepo.GetAll();

            if (!classes.Any())
            {
                return(Content(HttpStatusCode.NotFound, "List is empty"));
            }

            return(Ok(classes));
        }
Esempio n. 8
0
        public void Get_all_classes_test()
        {
            var repo   = new ClassRepository(context);
            var model  = new ClassEntity("GR2");
            var model2 = new ClassEntity("GR1");

            repo.AddNew(model);
            repo.AddNew(model2);
            var result = repo.GetAll();

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Count, 2);
            Assert.AreEqual(model.Id, result[1].Id);
            Assert.AreEqual(model2.Id, result[0].Id);
        }
Esempio n. 9
0
        [HttpGet] /*POSTMAN OK*/
        public IActionResult Get()
        {
            List <ClassDetailed> classList = _classRepo.GetAll().Select(x => x.DaltoDetailedApi()).ToList();

            if (!(classList is null))
            {
                foreach (ClassDetailed CD in classList)
                {
                    CD.Users = _userRepo.GetAllByClassId(CD.Id).Select(x => x.DalToForEntitiesApi());
                    if (CD.Users.Count() == 0)
                    {
                        CD.Users = null;
                    }
                }
                return(Ok(classList));
            }
Esempio n. 10
0
        public IEnumerable <Class> Get()
        {
            ClassRepository repository = new ClassRepository();

            return(repository.GetAll());
        }
 public void Refreshlist()
 {
     ClassList = _classRepository.GetAll();
 }
        public IEnumerable <Class> GetAll()
        {
            var classlist = sqlClassRepository.GetAll();

            return(classlist);
        }
 //[AdminAuthorization]
 public IHttpActionResult GetClass()
 {
     return(Ok(classrepo.GetAll()));
 }
 // GET: Library
 public ActionResult Index()
 {
     return(View(repo.GetAll()));
 }
 public IEnumerable <Class> GetAll()
 {
     return(repository.GetAll());
 }