Example #1
0
 public CalculateThirdPartyGrvStl13Steps()
 {
     _baseUrl             = "https://amtcalculator.azurewebsites.net/";
     _endPointService     = "api/GasbCalculator/CalculateThirdPartyGrvStl13";
     _thirdPartyGrvResult = new ThirdPartyGrvResult();
     _thirdPartyGrv       = new ThirdPartyGrv();
     _amtErrorMessage     = new AMTErrorMessage();
 }
 public DeriveCalendarPeriodSteps()
 {
     _baseUrl         = "https://amtcalculator.azurewebsites.net/";
     _endPointService = "api/GasbCalculator/DeriveCalendarPeriod";
     _calendarPeriod  = new CalendarPeriod();
     _calendarResult  = new CalendarPeriod();
     _amtErrorMessage = new AMTErrorMessage();
 }
 public IActionResult CalculateThirdPartyGrvStl13([FromBody] ThirdPartyGrv thirdPartyGrv)
 {
     try
     {
         return(Ok(_baseCalculatorService.CalculateThirdPartyGrvStl13(thirdPartyGrv)));
     }
     catch (Exception ex)
     {
         AMTErrorMessage errorMessage = new AMTErrorMessage
         {
             Message = ex.Message
         };
         return(BadRequest(errorMessage));
     }
 }
 public IActionResult DeriveCalendarPeriod([FromBody] CalendarPeriod calendarPeriod)
 {
     try
     {
         return(Ok(_baseCalculatorService.DeriveCalendarPeriod(calendarPeriod)));
     }
     catch (Exception ex)
     {
         AMTErrorMessage errorMessage = new AMTErrorMessage
         {
             Message = ex.Message
         };
         return(BadRequest(errorMessage));
     }
 }
Example #5
0
        public async Task WhenIpostthedatatoCalculateThirdPartyGrvStl13EndPointAsync()
        {
            using var httpClient = new HttpClient();
            StringContent content = new StringContent(JsonConvert.SerializeObject(_thirdPartyGrv), Encoding.UTF8, "application/json");

            using var response = await httpClient.PostAsync(_baseUrl + _endPointService, content);

            string apiResponse = await response.Content.ReadAsStringAsync();

            if (response.IsSuccessStatusCode)
            {
                _thirdPartyGrvResult = JsonConvert.DeserializeObject <ThirdPartyGrvResult>(apiResponse);
            }
            else
            {
                _amtErrorMessage = JsonConvert.DeserializeObject <AMTErrorMessage>(apiResponse);
            }
        }
        public async System.Threading.Tasks.Task WhenIPostTheDataToAPIAsync()
        {
            using var httpClient = new HttpClient();
            StringContent content = new StringContent(JsonConvert.SerializeObject(_calendarPeriod), Encoding.UTF8, "application/json");

            using var response = await httpClient.PostAsync(_baseUrl + _endPointService, content);

            string apiResponse = await response.Content.ReadAsStringAsync();

            if (response.IsSuccessStatusCode)
            {
                _calendarResult = JsonConvert.DeserializeObject <CalendarPeriod>(apiResponse);
            }
            else
            {
                _amtErrorMessage = JsonConvert.DeserializeObject <AMTErrorMessage>(apiResponse);
            }
        }