/// <summary> /// Copies all the properties from a source inventory model into this book model. /// </summary> /// <param name="source"></param> public override void CopyFrom(BaseInventoryModel source) { // Copy the base properties from the source. base.CopyFrom(source); // Check if the source inventory model is a book model and copy the specific book properties from the bookSource. if (source is BookModel bookSource) { Author = bookSource.Author; Publisher = bookSource.Publisher; } }
/// <summary> /// Copies all the properties from a source inventory model into this video game model. /// </summary> /// <param name="source"></param> public override void CopyFrom(BaseInventoryModel source) { // Copy the base properties from the source. base.CopyFrom(source); // Check if the source inventory model is a video game model and copy the specific video game properties from the videoGameSource. if (source is VideoGameModel videoGameSource) { Developer = videoGameSource.Developer; Rating = videoGameSource.Rating; } }
/// <summary> /// Copies all the properties from a source inventory model into this movie model. /// </summary> /// <param name="source"></param> public override void CopyFrom(BaseInventoryModel source) { // Copy the base properties from the source. base.CopyFrom(source); // Check if the source inventory model is a movie model and copy the specific movie properties from the movieSource. if (source is MovieModel movieSource) { Director = movieSource.Director; Duration = movieSource.Duration; } }
/// <summary> /// Copies all the information from a source base inventory model to this base inventory model. /// </summary> /// <param name="source">The base inventory model being copied.</param> public virtual void CopyFrom(BaseInventoryModel source) { // Check if the source is null and throw an exception if necessary. if (source == null) { throw new ArgumentNullException(nameof(source)); } // Copy all the property information from the source model. Title = source.Title; Cost = source.Cost; Genre = source.Genre; Platform = source.Platform; ReleaseYear = source.ReleaseYear; }