public async Task <Director> GetDirector(int DirectorId) { try { return(await _directorReposity.GetDirector(DirectorId)); } catch (System.Exception ex) { throw ex; } }
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)); }
public async Task <ActionResult <DirectorDTO> > GetDirector(int id) { var director = await _directorRepository.GetDirector(id).ConfigureAwait(false); if (director == null) { return(NotFound()); } return(director); }
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)); } } }
public async Task <Director> GetDirector(int id) { return(await _directorRepo.GetDirector(id)); }