public static void Delete(Amenity 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(Amenity 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(Amenity item) { try { var items = GetAll(); var oldItem = items.Where(p => p.Id == item.Id).FirstOrDefault(); items.Remove(oldItem); items.Add(item); Add(items); } catch { } }