public void RateMovie(RatingModel rating) { RatingDTO ratingDTO = ToRatingDTO(rating); if (_iRatingContext.DoesRatingExist(ratingDTO)) { _iRatingContext.UpdateRating(ratingDTO); } else { _iRatingContext.NewRating(ratingDTO); } }
public void Rate() { _logger.Logg("Starting rate."); _logger.Logg("Loading policy."); // load policy - open file policy.json string policyJson = _ratingContext.GetPolicy(); var policy = _ratingContext.GetDeserializedPolicy(policyJson); var raterPolicy = _ratingContext.GetFactory(policy); decimal rating = raterPolicy.Rate(policy); _ratingContext.UpdateRating(rating); _logger.Logg("Rating completed."); }
public override void Rate(Policy policy) { _logger.Log("Rating LAND policy..."); _logger.Log("Validating policy."); if (policy.BondAmount == 0 || policy.Valuation == 0) { Console.WriteLine("Land policy must specify Bond Amount and Valuation."); return; } if (policy.BondAmount < 0.8m * policy.Valuation) { _logger.Log("Insufficient bond amount."); return; } _ratingUpdater.UpdateRating(policy.BondAmount * 0.05m); _logger.Log("Land policy finished! "); }