public Author Add(AuthorToAddOrUpdate authorToAddOrUpdate) { var author = new Author( authors.GetNextId(), authorToAddOrUpdate.Name, authorToAddOrUpdate.Email); authors.Add(author.Id, author); return(author); }
public Author Update(int id, AuthorToAddOrUpdate authorToAddOrUpdate) { if (!authors.ContainsKey(id)) { return(null); } var updatedAuthor = new Author( id, authorToAddOrUpdate.Name, authorToAddOrUpdate.Email); authors[id] = updatedAuthor; return(updatedAuthor); }