public async Task PostSystemTask(string token, SystemTask model)
 {
     HouseWebClient client = new HouseWebClient(token);
     Dictionary <string, string> uriParams = new Dictionary <string, string>();
     string result = await client.SendRequest(MPEDHttpMethodType.Post, "api/SystemTasks",
                                              null, model, uriParams);
 }
        public async Task <UserAccountToken> GetToken(string userName, string password)
        {
            HouseWebClient client = new HouseWebClient();
            string         result = await client.SendRequest(MPEDHttpMethodType.Post, "Token",
                                                             null, string.Format("grant_type=password&username={0}&password={1}", userName, password), null);

            if (!string.IsNullOrEmpty(result))
            {
                return(JsonConvert.DeserializeObject <UserAccountToken>(result));
            }

            return(null);
        }
        public async Task <List <SystemTask> > GetTasks(string token)
        {
            HouseWebClient client = new HouseWebClient(token);
            Dictionary <string, string> uriParams = new Dictionary <string, string>();
            string result = await client.SendRequest(MPEDHttpMethodType.Get, "api/SystemTasks",
                                                     null, null, uriParams);

            if (!string.IsNullOrEmpty(result))
            {
                return(JsonConvert.DeserializeObject <List <SystemTask> >(result));
            }

            return(null);
        }
Ejemplo n.º 4
0
        public async Task <BuildingViewModel> FindBuildingFullData(string token, Guid id)
        {
            HouseWebClient client = new HouseWebClient(token);
            Dictionary <string, string> uriParams = new Dictionary <string, string>();

            uriParams.Add("buildingId", id.ToString());
            string result = await client.SendRequest(MPEDHttpMethodType.Get, "api/Buildings",
                                                     "FindBuildingFullData", null, uriParams);

            if (!string.IsNullOrEmpty(result))
            {
                return(JsonConvert.DeserializeObject <BuildingViewModel>(result));
            }

            return(null);
        }
Ejemplo n.º 5
0
 public async Task UpdateSensorsData(string token, UpdateSensorsDataViewModel model)
 {
     HouseWebClient client = new HouseWebClient(token);
     string         result = await client.SendRequest(MPEDHttpMethodType.Post, "api/ControlCircuits",
                                                      "UpdateSensorsData", model, null);
 }