// GET: School/Instructor/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var instructor = _instuctorRepository.GetInstructorById(id);

            InstructorViewModel vm = new InstructorViewModel();

            vm.Id                = instructor.Id;
            vm.InstructorName    = instructor.InstructorName;
            vm.InstructorContact = instructor.InstructorContact;

            if (instructor == null)
            {
                return(HttpNotFound());
            }
            return(View(vm));
        }
        public IActionResult GetInstructorById()
        {
            var accessTokenAsString = JwtHelper.GetTokenSubstring(Request.Headers["Authorization"].ToString());

            if (accessTokenAsString == "null")
            {
                return(Unauthorized());
            }
            var userCredentials = JwtHelper.GetCredentialsFromToken(accessTokenAsString);

            var id = userCredentials.Id;

            var instructorToGet = _instructorRepository.GetInstructorById(id);

            if (instructorToGet == null)
            {
                return(NotFound());
            }

            return(Ok(instructorToGet));
        }
示例#3
0
        public IActionResult GetInstructorById(Guid id)
        {
            Instructor instructor = _instructorRepository.GetInstructorById(id);

            return(Ok(instructor));
        }