public Document(BaseMedia media) : this() { if (media == null) { throw new ArgumentNullException("media"); } this.Copy(media); this.RawData = media.RawData; }
public BaseMedia Save(BaseMedia media) { #region argument checking if (media == null) { throw new ArgumentNullException("media"); } if (string.IsNullOrEmpty(media.Url)) { throw new ArgumentNullException("media.Url"); } if (string.IsNullOrEmpty(media.Name)) { throw new ArgumentNullException("media.Name"); } if (media.Owner == null) { throw new InvalidOperationException("media.Owner"); } #endregion return MediaDbInteractor.Instance.SaveMedia(media.Owner.Id, media.MediaType, media.Name, media.Url, media.RawData ?? string.Empty); }
public bool TryGetMedia(string url, out BaseMedia media) { media = null; bool success = false; try { media = GetMedia(SanitizeUrlKey(url)); success = true; } catch (MessageException) { } return success; }
public void Copy(BaseMedia media) { if (media == null) { throw new ArgumentNullException("media"); } this.Id = media.Id; this.MediaType = media.MediaType; this.Name = media.Name; this.Description = media.Description; this.Owner = media.Owner; this.Url = media.Url; this.InitializeTags(media.Tags); }