コード例 #1
0
        public NewNoteCommand(string s)
        {
            completeNote = string.IsNullOrWhiteSpace(s) ? "None" : s;
            WriteActions writeActions = new WriteActions();

            writeActions.Write(s);
        }
コード例 #2
0
        /// <summary>
        /// Write new request into persistent data json file on Azure
        /// </summary>
        /// <param name="objNewRequest">New complex request object to save</param>
        /// <returns>Action result type to specified the insertion or update</returns>
        public WriteActions WriteRegister(RequestObject objNewRequest)
        {
            //Read registration file
            List <RequestObject> objListRequest = ReadRegisters();

            //Specify if values is the request is alredy exists in the data file
            bool         boolIsNew    = true;
            WriteActions actionResult = WriteActions.None;

            //Check if ID exists on registers
            foreach (var item in objListRequest)
            {
                if (objNewRequest.ID == item.ID && objNewRequest.Type == item.Type)
                {
                    //update existing request
                    boolIsNew    = false;
                    item.Data    = objNewRequest.Data;
                    actionResult = WriteActions.Update;
                }
            }

            //if theres is no update on existing request
            if (boolIsNew)
            {
                objListRequest.Add(objNewRequest);
                actionResult = WriteActions.Creation;
            }

            //Upload new content in data file on azure
            GetCloudFile().UploadText(JsonConvert.SerializeObject(objListRequest));

            return(actionResult);
        }
コード例 #3
0
 public IHttpActionResult SaveDeviceScene(SceneEntity sceneObj)
 {
     WriteActions.WriteDeviceScene(sceneObj);
     ReadActions.SaveCurrentLutronQuatumDetail();
     return(Ok());
 }
コード例 #4
0
 public IHttpActionResult SaveLightState(DeviceEntity deviceObj)
 {
     WriteActions.WriteLightState(deviceObj);
     ReadActions.SaveCurrentLutronQuatumDetail();
     return(Ok());
 }