public static void Delete(Genre item) { try { var items = GetAll(); var itemToDelete = items.Where(p => p.Id == item.Id).FirstOrDefault(); items.Remove(itemToDelete); Add(items); } catch { } }
public static void Add(Genre item) { try { var items = GetAll(); if (items.Any(p => p.Id == item.Id || p.Name == item.Name)) return; items.Add(item); Add(items); } catch { } }
public static void Update(Genre item) { try { var items = GetAll(); var oldItem = items.Where(p => p.Id == item.Id).FirstOrDefault(); items.Remove(oldItem); items.Add(item); Add(items); } catch { } }