public static void AddAuthor(Author author) { Dictionary<long, string> fromCache = cachedAuthors; if (fromCache.ContainsKey(author.ID)) return; fromCache.Add(author.ID, author.ToString()); }
public static void UpdateAuthor(Author author) { using (Data.LibraryDataContext ctx = new LibraryDataContext()) { ctx.Authors.Attach(author); ctx.Entry(author).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); } }
public static void UpdateAuthor(Author author) { Dictionary<long, string> fromCache = cachedAuthors; if (fromCache.ContainsKey(author.ID)) fromCache[author.ID] = author.ToString(); else fromCache.Add(author.ID, author.ToString()); }