コード例 #1
0
        public async Task <IActionResult> PutTodoItem(int id, AddressItems addressItems)
        {
            if (id != addressItems.id)
            {
                return(BadRequest());
            }

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

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

            return(Ok(addressItems));           // This is where we set our put method, you can add addresses
                                                // to the database through postman.
        }
コード例 #2
0
        async Task ExecuteLoadItemsCommand()    // Will load the items in this section
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                AddressItems.Clear();
                ListAddressItems = App.LoggedInUser.Addresses;
                var addressitems = ListAddressItems;
                foreach (var address in addressitems)
                {
                    AddressItems.Add(address);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }