/// <summary> /// Create a new Game object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="platformID">Initial value of the PlatformID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="serviceID">Initial value of the ServiceID property.</param> public static Game CreateGame(global::System.Int32 id, global::System.Int32 platformID, global::System.String name, global::System.Int32 serviceID) { Game game = new Game(); game.ID = id; game.PlatformID = platformID; game.Name = name; game.ServiceID = serviceID; return game; }
public List<GamingEvent> GetEvents(User accessToken, Game game) { GameNickEntities entities = new GameNickEntities(); if (IsAuthenticated(accessToken, entities)) { List<GamingEvent> events = new List<GamingEvent>(); var result = entities.Events.Where(eEvent => eEvent.GameID == game.ID).ToList(); foreach (Event eEvent in result) { try { FacebookClient facebookClient = new FacebookClient(accessToken.FacebookAccessToken); dynamic fbEvent = facebookClient.Get(eEvent.FacebookID.ToString()); GamingEvent nEvent = new GamingEvent(); nEvent.Event = eEvent; if(fbEvent.description != null) nEvent.Description = fbEvent.description.ToString(); if(fbEvent.start_time != null) nEvent.StartTime = Convert.ToDateTime(fbEvent.start_time.ToString()); if(fbEvent.end_time != null) nEvent.EndTime = Convert.ToDateTime(fbEvent.end_time.ToString()); if(fbEvent.location != null) nEvent.Location = fbEvent.location.ToString(); if(fbEvent.name != null) nEvent.Name = fbEvent.name.ToString(); events.Add(nEvent); } catch (Exception e) { // todo: log error here } } if (events.Count == 0) { events.Add(new GamingEvent() {Name = "No events here"}); } return events; } throw new SecurityAccessDeniedException(); }
/// <summary> /// Deprecated Method for adding a new object to the Games EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToGames(Game game) { base.AddObject("Games", game); }