public EditArticleCommand(Article origin, Article updated)
 {
     _origin = origin;
     _originCopy = _origin.Copy();
     _updated = updated;
 }
Beispiel #2
0
        public void Save(Article article)
        {
            #region argument checking

            if (article == null)
            {
                throw new ArgumentNullException("article");
            }

            if (article.Owner == null)
            {
                throw new InvalidOperationException("article.Owner");
            }

            #endregion

            Article updatedArticle = null;

            if (article.Id == 0)
            {
                updatedArticle = ArticleStore.Instance.Save(this.Id, article);
            }
            else
            {
                updatedArticle = ArticleStore.Instance.Update(this.Id, article);
            }

            if (updatedArticle != null)
            {
                article.Copy(updatedArticle);
                article.IsDirty = false;
            }
        }