public async Task <HttpResponseMessage> UpdateHealth(HealthUpdateRequest request) { client.DefaultRequestHeaders.Add("Access-Control-Allow-Origin", "*"); client.DefaultRequestHeaders.Add("Access-Control-Allow-Credentials", "true"); client.DefaultRequestHeaders.Add("Access-Control-Allow-Headers", "Access-Control-Allow-Origin,Content-Type"); var serialized = System.Text.Json.JsonSerializer.Serialize(request); var stringContent = new StringContent(serialized, Encoding.UTF8, "application/json"); var result = await client.PostAsync($"/health/update", stringContent); return(result); }
public async Task HandleValidSubmit() { HttpResponseMessage result = null; if (Model.HealthId == null || Model.HealthId.Value == 0) { var request = new HealthCreateRequest(); request.Health.Created = Model.Created; request.Health.Modified = DateTime.UtcNow; request.Health.FromVet = Model.FromVet; request.Health.Height = Model.Height; request.Health.MouthCircumference = Model.MouthCircumference; request.Health.NoseEyeLength = Model.NoseEyeLength; request.Health.TailLength = Model.TailLength; request.Health.Waist = Model.Waist; request.Health.Weight = Model.Weight; request.Health.Dog = DogModel; result = await Client.CreateHealth(request); } else { var request = new HealthUpdateRequest(); request.Health.HealthId = Model.HealthId; request.Health.Deleted = Model.Deleted; request.Health.Created = Model.Created; request.Health.Modified = Model.Modified; request.Health.FromVet = Model.FromVet; request.Health.Height = Model.Height; request.Health.MouthCircumference = Model.MouthCircumference; request.Health.NoseEyeLength = Model.NoseEyeLength; request.Health.TailLength = Model.TailLength; request.Health.Waist = Model.Waist; request.Health.Weight = Model.Weight; request.Health.Dog = DogModel; result = await Client.UpdateHealth(request); } if (result.IsSuccessStatusCode) { NotificationService.Notify(NotificationSeverity.Success, "Saved successfully"); } else { NotificationService.Notify(NotificationSeverity.Error, "Failed", result.ReasonPhrase, 6000); } }
public bool UpdateHealth(HealthUpdateRequest request) { return(_healthRepository.UpdateHealth(request.Health)); }
public bool Update([FromBody] HealthUpdateRequest request) { return(_healthManager.UpdateHealth(request)); }