Exemple #1
0
 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 { }
 }
Exemple #2
0
        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 { }
        }
Exemple #3
0
        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 { }
        }