Exemplo n.º 1
0
        public List <string> GetStudents()
        {
            var students = _repo.GetStudents();

            List <string> retValue = new List <string>();

            foreach (StudentsDTO s in students)
            {
                retValue.Add(s.Name);
            }
            return(retValue);
        }
Exemplo n.º 2
0
        public IActionResult Index()
        {
            var students = _repository.GetStudents();

            var dataForView = new List <StudentViewModel>();

            foreach (var st in students)
            {
                var vm = new StudentViewModel();
                vm.IdStudent = st.IdStudent;
                vm.FirstName = st.FirstName;
                vm.LastName  = st.LastName;
                vm.Address   = st.Address;

                var grades = _repository.GetGrades(st.IdStudent);
                foreach (var g in grades)
                {
                    if (g.SubjectType == "Group 1")
                    {
                        vm.EctsSum += 5;
                    }
                    else if (g.Subject == "Group 2")
                    {
                        vm.EctsSum += 3;
                    }
                    else if (g.SubjectType == "Group 3")
                    {
                        vm.EctsSum += 1;
                    }

                    vm.AverageGrade += g.GradeValue;
                }

                if (grades.Count() > 0)
                {
                    vm.AverageGrade = vm.AverageGrade / grades.Count();
                }

                dataForView.Add(vm);
            }

            return(View(dataForView));
        }
Exemplo n.º 3
0
 public async Task OnGetAsync()
 {
     Students = await _studentsRepository.GetStudents();
 }
 public void LoadStudents()
 {
     _allStudents = new ObservableCollection <Data.Student>(_studentsRepository.GetStudents());
     Students     = _allStudents;
 }
Exemplo n.º 5
0
 public IActionResult GetAllStudents([FromServices] IStudentsRepository studentsRepository)
 {
     return(Ok(studentsRepository.GetStudents()));
 }
 public async Task <ActionResult <List <Student> > > GetStudents() => await _studentsRepository.GetStudents();
Exemplo n.º 7
0
 public async Task <List <Student> > GetAllStudentsAsync()
 {
     return(await studentsRepository.GetStudents());
 }
Exemplo n.º 8
0
 public IEnumerable <Student> GetAllStudents()
 {
     return(_repository.GetStudents());
 }