public IHttpActionResult PutValidStores(int id, ValidStores validStores)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != validStores.Id)
            {
                return(BadRequest());
            }

            db.Entry(validStores).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ValidStoresExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #2
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            /*using (SQLiteConnection conn = new SQLiteConnection(App.FilePath))
             * {
             *  conn.CreateTable<Resolved>();
             *  var Resolved_incidents = conn.Query<Resolved>("SELECT * FROM Resolved ORDER BY TimeResolved DESC");
             *
             *  ResolvedList.ItemsSource = Resolved_incidents;
             * }*/

            using (SQLiteConnection conn = new SQLiteConnection(App.FilePath))
            {
                conn.CreateTable <ValidStores>();
                var current_store_list = conn.Query <ValidStores>("SELECT * FROM ValidStores");
                if (current_store_list.Count() > 0)
                {
                    current_store = current_store_list[0];
                }

                else
                {
                    current_store.StoreName     = "ST158";
                    current_store.StoreLocation = "1997 E Beltline Ave NE, Grand Rapids, MI 49525, USA";
                    previous_store_name         = "ST158";
                }
            }

            //ResolvedIncidents();
        }
Exemple #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            ValidStores validStores = db.ValidStores.Find(id);

            db.ValidStores.Remove(validStores);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "Id,StoreName,StoreLocation")] ValidStores validStores)
 {
     if (ModelState.IsValid)
     {
         db.Entry(validStores).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(validStores));
 }
Exemple #5
0
        public ActionResult Create([Bind(Include = "Id,StoreName,StoreLocation")] ValidStores validStores)
        {
            if (ModelState.IsValid)
            {
                db.ValidStores.Add(validStores);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(validStores));
        }
        public IHttpActionResult GetValidStores(int id)
        {
            ValidStores validStores = db.ValidStores.Find(id);

            if (validStores == null)
            {
                return(NotFound());
            }

            return(Ok(validStores));
        }
        public IHttpActionResult PostValidStores(ValidStores validStores)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ValidStores.Add(validStores);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = validStores.Id }, validStores));
        }
Exemple #8
0
        // GET: ValidStores/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ValidStores validStores = db.ValidStores.Find(id);

            if (validStores == null)
            {
                return(HttpNotFound());
            }
            return(View(validStores));
        }
        public IHttpActionResult DeleteValidStores(int id)
        {
            ValidStores validStores = db.ValidStores.Find(id);

            if (validStores == null)
            {
                return(NotFound());
            }

            db.ValidStores.Remove(validStores);
            db.SaveChanges();

            return(Ok(validStores));
        }
        private void StoreSelectionList_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            ValidStores current_store = (ValidStores)e.SelectedItem;

            //Application.Current.Properties["StoreNumber"] = current_store.StoreNumber;
            //Application.Current.Properties["StoreName"] = current_store.StoreName;

            using (SQLiteConnection conn = new SQLiteConnection(App.FilePath))
            {
                conn.CreateTable <ValidStores>();
                conn.Execute("DELETE FROM ValidStores");
                int rowsAdded = conn.Insert(current_store);
            }

            this.Navigation.PopModalAsync();
        }
Exemple #11
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            using (SQLiteConnection conn = new SQLiteConnection(App.FilePath))
            {
                conn.CreateTable<ValidStores>();
                var current_store_list = conn.Query<ValidStores>("SELECT * FROM ValidStores");
                if (current_store_list.Count() > 0)
                {
                    current_store = current_store_list[0];
                }

                else
                {
                    current_store.StoreName = "ST158";
                    current_store.StoreLocation = "1997 E Beltline Ave NE, Grand Rapids, MI 49525, USA";
                    previous_store_name = "ST158";
                }
            }

            //CurrentConfirmedDevices();
        }
        protected override void OnAppearing()
        {
            base.OnAppearing();

            using (SQLiteConnection conn = new SQLiteConnection(App.FilePath))
            {
                conn.CreateTable <ValidStores>();
                var current_store_list = conn.Query <ValidStores>("SELECT * FROM ValidStores");
                if (current_store_list.Count() > 0)
                {
                    current_store = current_store_list[0];
                }

                else
                {
                    current_store.StoreName     = "ST158";
                    current_store.StoreLocation = "1997 E Beltline Ave NE, Grand Rapids, MI 49525, USA";
                }
            }

            StoreNameField.Text     = "You are currently connected to store " + current_store.StoreName;
            StoreLocationField.Text = current_store.StoreLocation;
        }