public ActionResult <Student> GetStudentById(int id) { Student StudentItem = _repository.GetById(id); if (StudentItem != null) { return(Ok(_mapper.Map <StudentReadDto>(StudentItem))); } return(NotFound()); }
public StudentViewModel GetStudent(int studentId) { var student = _studentRepository.GetById(studentId); if (student == null) { throw new ArgumentNullException(nameof(student)); } var result = StudentViewModel.ToStudentViewModel(student); //(StudentViewModel)student; //_mapper.Map<Student, StudentViewModel>(student); return(result); }
public Students Get(int id) { return(_studentRepo.GetById(id)); }