async Task Update() { try { SoilValidator _soilValidator = new SoilValidator(); ValidationResult validationResults = _soilValidator.Validate(_soil); if (validationResults.IsValid) { bool isUserAccept = await Application.Current.MainPage.DisplayAlert("Soil Details", "Save Soil Details", "OK", "Cancel"); if (isUserAccept) { _soil.LastModified = System.DateTime.UtcNow; _soilRepository.UpdateSoil(_soil); await _navigation.PopAsync(); } } else { await Application.Current.MainPage.DisplayAlert("Add Soil", validationResults.Errors[0].ErrorMessage, "Ok"); } } catch (Exception e) { var myerror = e.Message; // error // Log.Fatal(e); }; }
async Task Update() { try { SoilValidator _soilValidator = new SoilValidator(); _soil.PLOTID = _fk; ValidationResult validationResults = _soilValidator.Validate(_soil); if (validationResults.IsValid) { bool isUserAccept = await Application.Current.MainPage.DisplayAlert("Soil Details", "Save Soil Details", "OK", "Cancel"); if (isUserAccept) { _soil.Created = System.DateTime.UtcNow; _soil.LastModified = _soil.Created; _soilRepository.InsertSoil(_soil, _fk); // This is just to slow down the database _soilRepository.GetSoilData(_soil.SOILID); await _navigation.PopAsync(); } } else { await Application.Current.MainPage.DisplayAlert("Add Soil", validationResults.Errors[0].ErrorMessage, "Ok"); } } catch (Exception e) { var myerror = e.Message; // error // Log.Fatal(e); }; }