public int AddGenre(BaseGenre genre)
 {
     lock (genreLock)
     {
         if (!GetGenres().Any(g => g.Equals(genre)))
         {
             genre.Id = client.Cast<BaseGenre>().Select(g => g.Id).DefaultIfEmpty(-1).Max() + 1;
             client.Store(genre);
             client.Commit();
         }
     }
     return genre.Id;
 }
Beispiel #2
0
 public void RemoveGenre(BaseGenre genre)
 {
     lock (genres)
     {
         genres.Remove(genre);
     }
 }
Beispiel #3
0
 public bool IsGenre(BaseGenre genre)
 {
     bool isGenre = genres.Contains(genre);
     if(!isGenre)
     {
         int i = 0;
         lock (genres)
         {
             while (!isGenre && i < genres.Count)
             {
                 isGenre = genres[i].IsChildOf(genre);
                 i++;
             }
         }
     }
     return isGenre;
 }
Beispiel #4
0
 public void AddGenre(BaseGenre genre)
 {
     lock (genres)
     {
         if (!genres.Contains(genre))
         {
             genres.Add(genre);
         }
     }
 }
 public void UpdateGenre(BaseGenre g)
 {
     throw new System.NotImplementedException();
 }
 public int AddGenre(BaseGenre g)
 {
     throw new System.NotImplementedException();
 }
 public void UpdateGenre(BaseGenre g)
 {
     // ToDo: should we create a private IObjectContainer to set the update depth?
     lock(genreLock)
     {
         client.Store(g);
         client.Commit();
     }
 }
 public void RemoveGenre(BaseGenre genre)
 {
     lock (genreLock)
     {
         client.Delete(genre);
         client.Commit();
     }
 }