public ActionResult Post([FromBody] FormData data) { FormDataService service = new FormDataService(new FormDataRepository()); bool isSaved = service.SaveFormData(data); if (!isSaved) { return(StatusCode(400)); } return(Ok(isSaved)); }
public ActionResult <IEnumerable <string> > Get(string id) { FormDataService service = new FormDataService(new FormDataRepository()); FormData data = service.GetFormData(System.Convert.ToInt32(id)); if (data == null) { return(NotFound(id)); } return(Ok(data)); }
public ActionResult <string> Get() { FormDataService service = new FormDataService(new FormDataRepository()); var data = service.GetFormData(); if (data == null) { return(NotFound()); } return(Ok(Newtonsoft.Json.JsonConvert.SerializeObject(data))); }
public void FormDataService_DeSerializeTankSpecs_Deserializes() { double expectedHeight = 6; double expectedWidth = 12; double expectedDepth = 22; DateTime expectedWaterChangeTime = new DateTime(2018, 10, 10, 11, 00, 00); FormDataService formDataService = new FormDataService(); TankSpecs tankSpecs = formDataService.DeSerializeTankSpecs(tankSpecsXML); Assert.AreEqual(expectedWaterChangeTime, tankSpecs.WaterChangeTime, $"{nameof(tankSpecs.WaterChangeTime)} is not the same"); Assert.AreEqual(expectedDepth, tankSpecs.Depth, $"{nameof(tankSpecs.Depth)} is not the same"); Assert.AreEqual(expectedWidth, tankSpecs.Width, $"{nameof(tankSpecs.Width)} is not the same"); Assert.AreEqual(expectedHeight, tankSpecs.Height, $"{nameof(tankSpecs.Height)} is not the same"); }
private void sw_Toggled(object sender, ToggledEventArgs e) { //lblAnswer.lbl.Text = e.Value.ToString(); string val = "no"; if (e.Value) { val = "yes"; } else { val = "no"; } //FormDataService.UpdateFormDataValue(path, Convert.ToBoolean(e.Value)); FormDataService.UpdateFormDataValue(path, val); }
public void FormDataService_DeSerializeFeedingTimes_Deserializes() { double expectedPinches = 3; List <DateTime> expectedTimes = new List <DateTime>(); expectedTimes.Add(new DateTime(2018, 10, 10, 1, 0, 0)); expectedTimes.Add(new DateTime(2018, 10, 10, 14, 1, 0)); expectedTimes.Add(new DateTime(2018, 10, 10, 17, 0, 0)); expectedTimes.Add(new DateTime(2018, 10, 10, 2, 0, 0)); expectedTimes.Add(new DateTime(2018, 10, 10, 11, 0, 0)); FormDataService formDataService = new FormDataService(); FeedingTimes feedingTimes = formDataService.DeSerializeFeedingTimes(feedingXML); Assert.AreEqual(expectedPinches, feedingTimes.Pinches); CollectionAssert.AreEqual(expectedTimes, feedingTimes.Feedings, $"feeding times are not the same"); }
private async Task InitializeFormData() { try { if (IsOffline()) { this.formData = await FormDataService.GetFormLocalDataAsync(this.Form, this.RowId); } else if (IsOnline()) { if (webFormData == null) { webFormData = await FormDataService.GetFormLiveDataAsync(this.Page.RefId, this.RowId, App.Settings.CurrentLocId); } this.formData = webFormData?.ToDataSet(); this.filesData = webFormData?.ToFilesMeta(); } } catch (Exception ex) { EbLog.Error($"InitializeFormData error in form edit '{this.Page.DisplayName}'"); EbLog.Error(ex.Message); } }
private void sw_Toggled(object sender, ToggledEventArgs e) { //lblAnswer.lbl.Text = e.Value.ToString(); FormDataService.UpdateFormDataValue(path, Convert.ToBoolean(e.Value)); }
void DataEntry_Completed(object sender, EventArgs e) { //string insaneValue = dataEntry.Text; FormDataService.UpdateFormDataValue(editorPath, dataEntry.Text); }