Ejemplo n.º 1
0
        public CollectionViewModel(Collection data)
        {
            this.ID = data.ID;
            this.Icon = data.Icon;
            this.Name = data.Name;

            ProcessNumberOfGames(data);
        }
Ejemplo n.º 2
0
        public CollectionViewModel(Collection collection)
        {

            this.Games = new List<GameData>();

            this.ID = collection.ID;
            this.Name = collection.Name;
            this.Icon = collection.Icon;

            this.Games = collection.Games;
        }
Ejemplo n.º 3
0
 public static void AddNewCollection(string collectionName, string icon)
 {
     //GetDataBase();
     using (GameDataContext context = new GameDataContext(Constants.DBConnectionString))
     {
         Collection collection = new Collection();
         collection.Name = collectionName;
         collection.Icon = icon;
         context.Collection.InsertOnSubmit(collection);
         context.SubmitChanges();
     }
 }
Ejemplo n.º 4
0
        private void ProcessNumberOfGames(Collection data)
        {
            int total = 0;
            try
            {
                total = data.GameCollections.Count;
            }
            catch (System.Exception)
            {}

            string s = total == 1 ? "Game" : "Games"; 

            this.NumberOfGamesStringValue = string.Format("{0} {1} in collection", total, s);
        }
Ejemplo n.º 5
0
 public static Collection GetCollection(string id)
 {
     //GetDataBase();
     Collection collection = new Collection();
     using (GameDataContext context = new GameDataContext(Constants.DBConnectionString))
     {
         IQueryable<Collection> query = from c in context.Collection
                                        where c.ID.ToString() == id
                                        select c;
         collection = query.FirstOrDefault();
     }
     return collection;
 }