async Task UploadResponse() { //Add global fields _response.User_ID = UserSettings.UserId; _response.Farm_ID = App.SelectedFarm.ID; _response.Survey_Version = App.LatestSurvey.Version; var serviceResponse = await ApiManager.UploadResponse(_response); if (!serviceResponse.IsSuccessStatusCode) { PageDialog.Alert("Unable to upload the assessment currently!", "Error", "OK"); } else { PageDialog.Toast("Assessment Saved"); //Reshuffle assessment data if (App.LatestSurveyResponse != null) { App.PreviousSurveyResponse = App.LatestSurveyResponse; } App.LatestSurveyResponse = _response; //Empty MonkeyCache. Barrel.Current.Empty(key: "GetResponseByFarmId" + App.SelectedFarm.ID); } }
async Task SaveFarm() { var isNew = _currentFarm.ID == 0 ? true : false; var response = await ApiManager.UploadFarm(_currentFarm, isNew); if (!response.IsSuccessStatusCode || !(response.StatusCode == HttpStatusCode.NoContent)) { await PageDialog.AlertAsync("Unable to save farm details", "Error", "OK"); } else { //Empty MonkeyCache farmlist for this user. Barrel.Current.Empty(key: "GetFarmsByUserId" + UserSettings.UserId); PageDialog.Toast("Farm Saved"); } }
private async Task UploadCowStatus(CowStatusDto status) { HttpResponseMessage response; if (InputMode.Equals("dryoff")) { response = await ApiManager.CreateCowStatus(status); } else { response = await ApiManager.UpdateCowStatus(status); } if (!response.IsSuccessStatusCode) { await PageDialog.AlertAsync("Unable to save cow status data", "Error", "OK"); } else { PageDialog.Toast("Cow status saved"); } }