Esempio n. 1
0
        public async Task <ActionResult> RetrieveOSBBData([FromBody] OSBB dataOSBB)
        {
            client = new FireSharp.FirebaseClient(iconfig);
            FirebaseResponse response = await client.GetTaskAsync("OSBB/" + dataOSBB.osbb_id);

            OSBB obj = response.ResultAs <OSBB>();

            return(StatusCode(200, new
            {
                osbb_id = obj.osbb_id,
                osbb_name = obj.osbb_name,
                osbb_director_uid = obj.osbb_director_uid,
                osbb_director_name = obj.osbb_director_name,
                osbb_details = obj.osbb_details,
                osbb_living_area = obj.osbb_living_area,
                osbb_additional_area = obj.osbb_additional_area,
                osbb_non_living_area = obj.osbb_non_living_area,
                osbb_num_apartments = obj.osbb_num_apartments
                                      //data
            }
                              ));
        }
        public async Task <ActionResult> CreateOSBB([FromBody] OSBB osbbData)
        {
            client = new FireSharp.FirebaseClient(iconfig);

            var data = new OSBB
            {
                osbb_id              = "OS_" + osbbData.osbb_director_uid,
                osbb_name            = osbbData.osbb_name,
                osbb_director_uid    = osbbData.osbb_director_uid,
                osbb_director_name   = osbbData.osbb_director_name,
                osbb_details         = osbbData.osbb_details,
                osbb_living_area     = osbbData.osbb_living_area,
                osbb_additional_area = osbbData.osbb_additional_area,
                osbb_non_living_area = osbbData.osbb_non_living_area,
                osbb_num_apartments  = osbbData.osbb_num_apartments
            };
            SetResponse response = await client.SetTaskAsync("OSBB/" + data.osbb_id, data);

            OSBB result = response.ResultAs <OSBB>();

            return(StatusCode(200, new { created_osbb_id = data.osbb_id }));
        }