Example #1
0
        public IHttpActionResult GetStoresById(int id)
        {
            getStores store = null;

            using (BackNetEntity db = new BackNetEntity())
            {
                //IQueryable<stores> list =
                //    from s in db.stores
                //    select new stores
                //    {
                //        id = s.id,
                //        name = s.name,
                //        address = s.address
                //    };

                store = db.stores.Include("StoreAdd")
                        .Where(s => s.id == id)
                        .Select(s => new getStores()
                {
                    id      = s.id,
                    name    = s.name,
                    address = s.address
                }).FirstOrDefault <getStores>();
            }

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

            return(Ok(store));
        }
Example #2
0
        private async void refreshGetById(string resultSearch = null)
        {
            string respuesta = await GetHttpByID();

            getStores storeId =
                JsonConvert.DeserializeObject <getStores>(respuesta);

            dgvStores.DataSource = storeId;

            iniciarControles();
        }