public CollectionViewModel(Collection data) { this.ID = data.ID; this.Icon = data.Icon; this.Name = data.Name; ProcessNumberOfGames(data); }
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; }
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(); } }
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); }
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; }