public bool UpdateExistingContent(string originalTitle, StreamingContent newContent) { StreamingContent oldContent = GetContentByTitle(originalTitle); if (oldContent != null) { oldContent.Title = newContent.Title; oldContent.Description = newContent.Description; oldContent.StarRating = newContent.StarRating; oldContent.MaturityRating = newContent.MaturityRating; oldContent.TypeOfGenre = newContent.TypeOfGenre; return(true); } else { return(false); } }
public bool UpdateExistingContent(string originalTitle, StreamingContent updatedContent) { StreamingContent oldContent = GetContentByTitle(originalTitle); if (oldContent != null) { oldContent.Title = updatedContent.Title; oldContent.RunTimeInMin = updatedContent.RunTimeInMin; oldContent.ReleaseDate = updatedContent.ReleaseDate; oldContent.IsFamilyFriendly = updatedContent.IsFamilyFriendly; oldContent.TypeOfGenre = updatedContent.TypeOfGenre; return(true); } else { return(false); } }
//Update public bool UpdateExistingContent(string originalTitle, StreamingContent newContent) { StreamingContent oldContent = GetContentByTitle(originalTitle); //creates a new instance of StreamingContent gets the contents of original title they would like to update and merges it with new content if (oldContent != null) // if the original title is there then it procces to updating the the oldcontent of the original title to the new content that the user inputs { oldContent.Title = newContent.Title; // if you didnt want the user to be able to change a given property you would leave it out of this list. oldContent.Description = newContent.Description; // oldContent.StarRating = newContent.StarRating; // oldContent.MaturityRating = newContent.MaturityRating; // oldContent.TypeOfGenre = newContent.TypeOfGenre; // return(true); } else { return(false); } }
// Update public bool UpdateExistingContent(string originalTitle, StreamingContent newContent) { // Find the content StreamingContent oldContent = GetContentByTitle(originalTitle); // Update the content if (oldContent != null) { oldContent.Title = newContent.Title; oldContent.StarRating = newContent.StarRating; oldContent.Description = newContent.Description; oldContent.Language = newContent.Language; oldContent.Genre = newContent.Genre; oldContent.MaturityRating = newContent.MaturityRating; oldContent.TypeOfStreamingQuality = newContent.TypeOfStreamingQuality; return(true); } else { return(false); } }
public bool DeleteExistingContent(StreamingContent existingContent) { bool deleteResult = _contentDirectory.Remove(existingContent); return(deleteResult); }
public void Add(StreamingContent test) => _contentDirectory.Add(test);
}// one reason you might do this is to act a built in test so if it didnt it will report error users, catch if something goes wrong public StreamingContent AddContentToDirectorys(StreamingContent content) { _contentDirectory.Add(content); return(content); }
//Delete public bool DeleteExistingContent(StreamingContent existingContent) // creates new instances called existingContent { bool deleteResult = _contentDirectory.Remove(existingContent); // bool will return true if the existingContent is successfully deleted return(deleteResult); }