Exemple #1
0
        public IHttpActionResult AddBeacon(BeaconGetModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Beacon beacon = new Beacon(model);
            //{
            //    Beacon_id =model.Beacon_id,
            //    Beacon_major = model.Beacon_major,
            //    Beacon_minor =model.Beacon_minor,
            //    Beacon_message =model.Beacon_message,
            //    Beacon_rssi =model.Beacon_rssi,
            //    Beacon_title =model.Beacon_title,
            //    Beacon_trigger_interval =model.Beacon_trigger_interval,
            //    Beacon_trigger_proximity =model.Beacon_trigger_proximity,
            //    Beacon_uuid =model.Beacon_uuid,
            //    IsDeleted = false
            //};

            int response = _beaconLog.BeaconInsert(beacon);

            //int inserData = binding.Save();
            if (response == 1)
            {
                return(Ok("Record added to the database"));
            }
            else
            {
                return(BadRequest("Not able to save the record in database"));
            }
        }
Exemple #2
0
 public Beacon(BeaconGetModel beacon)
 {
     this.Beacon_id                = beacon.Beacon_id;
     this.Beacon_major             = beacon.Beacon_major;
     this.Beacon_message           = beacon.Beacon_message;
     this.Beacon_minor             = beacon.Beacon_minor;
     this.Beacon_rssi              = beacon.Beacon_rssi;
     this.Beacon_title             = beacon.Beacon_title;
     this.Beacon_trigger_interval  = beacon.Beacon_trigger_interval;
     this.Beacon_trigger_proximity = beacon.Beacon_trigger_proximity;
     this.Beacon_uuid              = beacon.Beacon_uuid;
     this.IsDeleted                = beacon.IsDeleted;
 }
Exemple #3
0
        public int BeaconNameUpdate(EditBeaconBindingModel model)
        {
            BeaconGetModel beacon1 = BeaconGet(model.Beacon_id);
            Beacon         beacon  = new Beacon(beacon1);

            if (beacon != null)
            {
                beacon.Beacon_title = model.Beacon_title;
            }
            this.binding.GetBeaconRepository.Attach(beacon);
            int result = this.binding.Save();

            if (result > 0)
            {
                result = 1;
                return(result);
            }
            else
            {
                result = 0;
                return(result);
            }
        }