private async void btnSubmit_Clicked(object sender, EventArgs e) { var getDepartmentID = (from x in _departmentList where x.Name == pDepartment.SelectedItem.ToString() select x.ID).First(); var getLocationID = (from x in _locationList where x.Name == pLocation.SelectedItem.ToString() select x.ID).First(); var assetGroupID = (from x in _assetGroupsList where x.Name == pAssetGroup.SelectedItem.ToString() select x.ID).First(); var getDepartmentLocationID = (from x in _departmentLocationsList where x.DepartmentID == getDepartmentID && x.LocationID == getLocationID select x.ID).First(); var getEmployeeID = (from x in _accountableList where pAccountable.SelectedItem.ToString() == x.FirstName + " " + x.LastName select x.ID).First(); var newAsset = new Asset() { AssetSN = lblAssetSN.Text, WarrantyDate = dpExpired.Date, Description = editorDescription.Text, AssetName = entryAssetName.Text, AssetGroupID = assetGroupID, DepartmentLocationID = getDepartmentLocationID, EmployeeID = getEmployeeID }; var JsonData = JsonConvert.SerializeObject(newAsset); var apiCaller = new WebApi(); var response = await apiCaller.PostAsync("Assets/Create", JsonData); if (response == "\"Asset created successfully!\"") { await DisplayAlert("Asset Creation/Modifications", "Asset created successfully!", "Ok"); await Navigation.PopAsync(); } }
private async Task LoadDetails() { var apiCaller = new WebApi(); }