public ListOfDVDResponse GetByDirector(string director) { ListOfDVDResponse response = new ListOfDVDResponse(); List <DVD> dvdList = _dvdRepo.GetByDirector(director); response.DVDs = new List <DVDView>(); foreach (DVD dvd in dvdList) { DVDView listByDirector = new DVDView(); listByDirector.dvdId = dvd.dvdId; listByDirector.title = dvd.title; listByDirector.director = dvd.director.directorName; listByDirector.rating = dvd.rating.ratingName; listByDirector.realeaseYear = dvd.releaseYear; listByDirector.notes = dvd.notes; response.DVDs.Add(listByDirector); } if (dvdList == null) { response.Success = false; response.Message = "There are no DVDs with this director name."; } else { response.Success = true; } return(response); }
public IHttpActionResult GetByDirector(string director) { IDVDRepo repo = Factory.Create(); return(Ok(repo.GetByDirector(director))); }