public async Task <IActionResult> GetSingleStudentAsync([FromRoute] int id)
        {
            var item = await _context.Get(id);

            if (item == null)
            {
                return(NotFound(new DataError("Student not found")));
            }

            return(Ok(_mapper.Map <ReadStudentDto>(item)));
        }
Beispiel #2
0
        public IActionResult Students()
        {
            var students = _studentsRepository.Get().ToList();

            return(View(
                       new StudentsViewModel
            {
                Students = students
            }
                       ));
        }
        public async Task <IActionResult> GetSingleStudentAsync([FromRoute] int id)
        {
            var item = await _context.Get(id);

            if (item == null)
            {
                _log.AddLog(Request, _httpContextAccessor, this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), $"Nuk eshte gjetur studenti me id: {id}");
                return(NotFound(new DataMessage("Student not found")));
            }
            _log.AddLog(Request, _httpContextAccessor, this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), $"Eshte nxjerrur studenti me id: {id}");
            return(Ok(_mapper.Map <ReadStudentDTO>(item)));
        }
Beispiel #4
0
 public IActionResult Edit(int id)
 {
     if (ModelState.IsValid)
     {
         var emp      = studentsRepository.Get(id);
         var students = new EditStudentsViewsModel
         {
             Email    = emp.Email,
             NgaySinh = emp.NgaySinh,
             GioiTinh = emp.GioiTinh,
             HoTen    = emp.Name,
             Id       = emp.Id,
             LopHocId = emp.LopHocId
         };
         ViewBag.LopHoc = GetLopHocs();
         return(View(students));
     }
     return(View());
 }
Beispiel #5
0
        public void LoadDetails(SchoolView item)
        {
            Students.Clear();

            if (item is null)
            {
                return;
            }
            students.FixedFilter = GetMember.Name <StudentData>(x => x.SchoolId);
            students.FixedValue  = item.Id;
            var list = students.Get().GetAwaiter().GetResult();

            foreach (var e in list)
            {
                Students.Add(StudentViewFactory.Create(e));
            }
        }
Beispiel #6
0
        public void PrintInfo()
        {
            var students      = _studentsRepository.Get();
            var teachers      = _teachersRepository.Get();
            var grades        = _gradesRepository.Get();
            var lessonClasses = _lessonClassesRepository.Get();

            Console.WriteLine("Students:");
            PrintEntities(students);

            Console.WriteLine("Teachers:");
            PrintEntities(teachers);

            Console.WriteLine("Grades:");
            PrintEntities(grades);

            Console.WriteLine("Classes:");
            PrintEntities(lessonClasses);
        }
        private void OnCardInserted(object sender, CardInsertedEventArgs e)
        {
            Student student = null;

            if (e.Value.HasValue)
            {
                student = _studentsRepository.Get(e.Value.Value);
            }

            CardInserted?.Invoke(this, new StudentCardEventArgs
            {
                Student      = student,
                IsSuccess    = student != null,
                ErrorMessage = e.Value.HasValue
                    ? (e.Value == UnbindStudentId
                        ? "Карта ни к кому не привязана"
                        : $"Ученик с ID = {e.Value} не найден")
                    : "Ошибка чтения карты, попробуйте снова"
            });
        }
 public IEnumerable <Student> Get()
 {
     return(_studentsRepository.Get());
 }
 public Student Get(int id)
 {
     return(repository.Get(id));
 }