コード例 #1
0
 public async Task <Director> GetDirector(int DirectorId)
 {
     try
     {
         return(await _directorReposity.GetDirector(DirectorId));
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        public IActionResult GetDirector(int directorId)
        {
            if (!directorRepository.DirectorExists(directorId))
            {
                return(NotFound());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var director    = directorRepository.GetDirector(directorId);
            var directorDTO = new DirectorDTO()
            {
                Id        = director.Id,
                FirstName = director.FirstName,
                LastName  = director.LastName
            };

            return(Ok(directorDTO));
        }
コード例 #3
0
        public async Task <ActionResult <DirectorDTO> > GetDirector(int id)
        {
            var director = await _directorRepository.GetDirector(id).ConfigureAwait(false);

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

            return(director);
        }
コード例 #4
0
 public async Task <ActionResult <GetDirectorModel> > GetDirector(string id)
 {
     try
     {
         if (!Guid.TryParse(id, out Guid directorId))
         {
             throw new GuidException("Invalid id", this.GetType().Name, "GetDirector", "400");
         }
         return(await _directorRepository.GetDirector(id));
     }
     catch (MovieMindException e)
     {
         if (e.MovieMindError.Status.Equals("404"))
         {
             return(NotFound(e.MovieMindError));
         }
         else
         {
             return(BadRequest(e.MovieMindError));
         }
     }
 }
コード例 #5
0
 public async Task <Director> GetDirector(int id)
 {
     return(await _directorRepo.GetDirector(id));
 }