//Update - bool to return true or false public bool UpdateExistingContent(string originalTitle, StreamingContent newContent) { // Find the content StreamingContent oldContent = GetContentByTitle(originalTitle); //Update the content if (oldContent != null) { //Assigning new properties in place of the old ones. oldContent.Title = newContent.Title; oldContent.Description = newContent.Description; oldContent.MaturityRating = newContent.MaturityRating; oldContent.IsFamilyFriendly = newContent.IsFamilyFriendly; oldContent.StarRating = newContent.StarRating; oldContent.TypeOfGenre = newContent.TypeOfGenre; return(true); } else { return(false); } }
//Delete public bool RemoveContentFromList(string title) { StreamingContent content = GetContentByTitle(title); if (content == null) //Checking if content, or title, is there. { return(false); } int initialCount = _listOfContent.Count; _listOfContent.Remove(content); if (initialCount > _listOfContent.Count) { return(true); } else { return(false); } }
private List <StreamingContent> _listOfContent = new List <StreamingContent>(); //Field=Var in class for anywhere //Create public void AddContentToList(StreamingContent content) { _listOfContent.Add(content); //Anything w/ _ is a field } //_listOfContent=field & ListOfContent=property