private CowStatusDto InitCowStatus() { CowStatusDto cowStatus = new CowStatusDto(); if (InputMode.Equals("dryoff")) { cowStatus.CowIdentifier = CowId; cowStatus.InfectedAtDryOff = CowInfected; cowStatus.Farm_ID = App.SelectedFarm.ID; cowStatus.DateAddedDryOff = DateTime.Now; } else { cowStatus.CowIdentifier = CowId; cowStatus.InfectedAtCalving = CowInfected; cowStatus.Farm_ID = App.SelectedFarm.ID; cowStatus.DateAddedCalving = DateTime.Now; } return(cowStatus); }
private async void FinishInput() { if (!string.IsNullOrEmpty(CowId)) { CowStatusDto cs = InitCowStatus(); if (!Config.TestMode) { await RunSafe(UploadCowStatus(cs)); } } if (InputMode.Equals("dryoff")) { await NavigationService.NavigateAsync("CowStatusFinishPage"); } else { await PopulateCowStatusData(); await NavigationService.NavigateAsync("CowStatusResultsPage"); } }
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"); } }