public Article Add(ArticleToAddOrUpdate articleToAddOrUpdate) { var article = new Article( articles.GetNextId(), articleToAddOrUpdate.AuthorId, articleToAddOrUpdate.Title, articleToAddOrUpdate.Body); articles.Add(article.Id, article); return(article); }
public Article Update(int id, ArticleToAddOrUpdate articleToAddOrUpdate) { if (!articles.ContainsKey(id)) { return(null); } var updatedArticle = new Article( id, articleToAddOrUpdate.AuthorId, articleToAddOrUpdate.Title, articleToAddOrUpdate.Body); articles[id] = updatedArticle; return(updatedArticle); }