Esempio n. 1
0
		// POST /api/games/gameId
		public async Task<IHttpActionResult> Post(string gameId, [FromBody]CountEvent countEvent)
		{
			using (var context = new GameCountContext())
			{
				var gameCountEvent = new GameCountEvent
				{
					Game = gameId,
					Player = countEvent.player,
					Count = countEvent.count
				};

				context.Events.Add(gameCountEvent);
				await context.SaveChangesAsync();
			}

			var myHub = GlobalHost.ConnectionManager.GetHubContext<MyHub>();
			myHub.Clients.Group(gameId).addMessage("server", "reload");

			return Ok();
		}