コード例 #1
0
        public async Task <ActionResult <Instructor> > GetInstructorById(string instructorId)
        {
            if (string.IsNullOrEmpty(instructorId))
            {
                return(NotFound());
            }

            try
            {
                var instructor = await instructorService.GetInstructorByIdAsync(instructorId);

                if (instructor == null)
                {
                    return(NotFound());
                }
                else
                {
                    return(Ok(instructor));
                }
            }
            catch (Exception e)
            {
                return(await HandleControllerException(e));
            }
        }