Beispiel #1
0
        public async Task <ActionResult> DeleteConfirmed(Guid id)
        {
            BeaconInformation beaconInformation = await db.BeaconInformations.FindAsync(id);

            db.BeaconInformations.Remove(beaconInformation);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Position,Latitude,Longitude,Floor,LaserPointerInformationId")] BeaconInformation beaconInformation)
        {
            if (ModelState.IsValid)
            {
                db.Entry(beaconInformation).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(beaconInformation));
        }
Beispiel #3
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Position,Latitude,Longitude,Floor,LaserPointerInformationId")] BeaconInformation beaconInformation)
        {
            if (ModelState.IsValid)
            {
                beaconInformation.Id = Guid.NewGuid();
                db.BeaconInformations.Add(beaconInformation);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(beaconInformation));
        }
Beispiel #4
0
        // GET: BeaconInformations/Edit/5
        public async Task <ActionResult> Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BeaconInformation beaconInformation = await db.BeaconInformations.FindAsync(id);

            if (beaconInformation == null)
            {
                return(HttpNotFound());
            }
            return(View(beaconInformation));
        }
Beispiel #5
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            UUID = (string)e.Parameter;
            TextLBeaconID.Text = "LBeaconID: " + UUID;
            BeaconInformation BI =
                PointPage.BeaconInformations.Where(
                    c => c.Id == Guid.Parse(UUID)).First();
            LaserPointerInformation LPI =
                PointPage.LaserPointerInformations.Where(
                    c => c.Id == BI.LaserPointerInformationId).First();

            latitude.Text       = "經度: " + BI.Latitude.ToString();
            longitude.Text      = "緯度: " + BI.Longitude.ToString();
            ReferencePoint.Text = "地點: " + LPI.Position;

            facePoint   = new GeoCoordinate(LPI.FaceLatitude, LPI.FaceLongitude);
            CenterPoint = new GeoCoordinate(LPI.Latitude, LPI.Longitude);
            targetPoint = new GeoCoordinate(BI.Latitude, BI.Longitude);
        }