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