public UserEntity InsertUser(string userId, string name, string info)
        {
            TableOperation insertOperation;

            try
            {
                //get table
                CloudTable sensorTable = _CloudService.CreateTableAsync("user");

                insertOperation = TableOperation.Insert(new UserEntity(userId, name, info));
                sensorTable.Execute(insertOperation);
            }
            catch (Exception e)
            {
                throw e;
            }
            return((UserEntity)insertOperation.Entity);
        }
Пример #2
0
        public DataEntity InsertSensorData(string userId, string rowKey, int distance)
        {
            TableOperation insertOperation;

            try
            {
                //get table
                CloudTable sensorTable = _CloudService.CreateTableAsync("sensor");

                //insert
                insertOperation = TableOperation.Insert(new DataEntity(userId, rowKey, distance));
                sensorTable.Execute(insertOperation);
            }
            catch (Exception e)
            {
                throw e;
            }

            return((DataEntity)insertOperation.Entity);
        }