示例#1
0
        public static AgreementExtended GetExtendedAgreement(Agreement agreement, BaseRate.RateType newBaseRateType, float oldBaseRateValue, float newBaseRateValue)
        {
            var agremeentExtended = new AgreementExtended(agreement, newBaseRateType);

            agremeentExtended.CurrentInterestRate = CalculateInterestRate(oldBaseRateValue, agremeentExtended.Margin);
            agremeentExtended.NewInterestRate     = CalculateInterestRate(newBaseRateValue, agremeentExtended.Margin);

            agremeentExtended.DifferenceBetweenInterestRates =
                CalculateDifference(agremeentExtended.CurrentInterestRate, agremeentExtended.NewInterestRate);

            return(agremeentExtended);
        }
示例#2
0
        public static async Task <AgreementExtended> UpdateAgreementBaseRate(string path, BaseRate.RateType newBaseRateType)
        {
            HttpResponseMessage response = null;

            using (HttpClient client = ConfigureHttpClient())
            {
                response = await client.PutAsJsonAsync(path, newBaseRateType);
            }

            AgreementExtended result = null;

            if (response.IsSuccessStatusCode)
            {
                result = await response.Content.ReadAsAsync <AgreementExtended>();
            }

            return(result);
        }
示例#3
0
        public async Task <ActionResult> EditAgreement(int id, BaseRate.RateType newBaseRateType)
        {
            AgreementExtended agreementExtended = await ApiCalls.UpdateAgreementBaseRate($"api/rates/{id}", newBaseRateType);

            return(View("AgreementExtended", agreementExtended));
        }