public async Task AddPrescriptionAsync(AddPrescriptionDto prescriptionDto)
        {
            var request = new HttpRequestMessage(HttpMethod.Post,
                                                 $"https://localhost:44381/add-prescription");

            request.Headers.Add("Accept", "application/json");

            var options = new JsonSerializerOptions
            {
                PropertyNameCaseInsensitive = true,
            };

            var jsonString = JsonSerializer.Serialize(prescriptionDto, options);
            var content    = new StringContent(jsonString, Encoding.UTF8, "application/json");

            request.Content = content;

            var client = clientFactory.CreateClient();

            var response = await client.SendAsync(request);

            using var responseStream = await response.Content.ReadAsStreamAsync();
        }
Ejemplo n.º 2
0
 public async Task AddPrescriptionAsync(AddPrescriptionDto prescriptionDto)
 {
     await prescriptionServiceClient.AddPrescriptionAsync(prescriptionDto);
 }
Ejemplo n.º 3
0
 public async Task AddNewPrescription([FromBody] AddPrescriptionDto prescriptionDto)
 {
     await doctorsHandler.AddPrescriptionAsync(prescriptionDto);
 }