// POST api/data
        public HttpResponseMessage Post([FromBody]string value)
        {
            //value = this.Request.Content.ReadAsStringAsync().Result;

            if (!string.IsNullOrEmpty(value))
            {
                var theValues = value.Split(',');

                TemperatureRecord temp = new TemperatureRecord();
                LightLevelRecord light = new LightLevelRecord();
                temp.Temperature = Convert.ToDecimal(theValues[0]);
                light.LightLevel = ConvertLightToOneToHunderRangeValue(Convert.ToInt32(theValues[1]));
                bool isCountIncremented = false;
                if (!string.IsNullOrEmpty(theValues[2]) && Convert.ToInt32(theValues[2]) > 0)
                    isCountIncremented = true;

                var theDatabase = GetDatabase();

                InfoDataHub.SendTemperature(temp);
                InfoDataHub.SendLightLevel(light);

                Task.Factory.StartNew(() =>
                {
                    try
                    {
                        theDatabase.GetCollection<TemperatureRecord>("TemperatureRecord").Insert(temp);
                        theDatabase.GetCollection<LightLevelRecord>("LightLevelRecord").Insert(light);
                        if (isCountIncremented)
                        {
                            var theTimeToTheMinute = string.Format("{0:yyyy-MM-dd HH:mm}", DateTime.Now);
                            var update = Update.Inc("Count", 1).Set("TheTimeStamp", DateTime.Now);
                            theDatabase.GetCollection<CrowdCountRecord>("CrowdCountRecord").Update(Query.EQ("TimeToTheMinute", theTimeToTheMinute), update, UpdateFlags.Upsert);
                        }
                    }
                    catch (Exception ex) { }
                });

                return this.Request.CreateResponse(HttpStatusCode.Accepted);
            }

            return this.Request.CreateResponse(HttpStatusCode.InternalServerError);
        }
 public void Send(TemperatureRecord temperature, LightLevelRecord lightLevel)
 {
 }
 public static void SendLightLevel(LightLevelRecord lightLevel)
 {
     var hubContext = GlobalHost.ConnectionManager.GetHubContext<InfoDataHub>();
     hubContext.Clients.All.sendLightLevel(lightLevel.LightLevel.ToString());
 }