예제 #1
0
        public async Task <IActionResult> PutTba(int id, Tba tba)
        {
            if (id != tba.Id)
            {
                return(BadRequest());
            }

            _context.Entry(tba).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TbaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <Tba> > PostTba(Tba tba)
        {
            _context.Tba.Add(tba);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTba", new { id = tba.Id }, tba));
        }
        private void OnItemTapped(object sender, ItemTappedEventArgs e)
        {
            DetailPage d   = new DetailPage();
            Tba        tba = (Tba)((ListView)sender).SelectedItem;

            tbaViewModel.Name = tba.name;
            IsPresented       = false;
        }
예제 #4
0
파일: RestApi.cs 프로젝트: 1amToxic/SM
        public async void  GetTaskAsync()
        {
            //Console.WriteLine("AppLog2");
            //string content = await httpClient.GetStringAsync(url1); //Sends a GET request to the specified Uri and returns the response body as a string in an asynchronous operation
            //tba = JsonConvert.DeserializeObject<Tba>(content); //Deserializes or converts JSON String into a collection of Post

            try
            {
                HttpResponseMessage response = await httpClient.GetAsync(url1);

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    Console.WriteLine("AppLog2");
                    tba = JsonConvert.DeserializeObject <Tba>(await response.Content.ReadAsStringAsync());
                    ViewModelLocator.MainViewModel.QuanLys = new ObservableCollection <QuanLy>(tba.quanLy);
                }
            }
            catch (Exception e)
            {
            }
        }