private static void AddRate(int productId, double productRate, RxRates rates, RasterGridPrescription prescription, UnitOfMeasure uom)
{
RxProductLookup rxProductLookup;
if (prescription.RxProductLookups.Any(x => x.ProductId == productId))
rxProductLookup = prescription.RxProductLookups.Single(x => x.ProductId == productId);
else
{
rxProductLookup = new RxProductLookup
{
ProductId = productId,
UnitOfMeasure = uom
};
prescription.RxProductLookups.Add(rxProductLookup);
}
var rxRate = new RxRate
{
Rate = productRate,
RxProductLookupId = rxProductLookup.Id.ReferenceId,
};
rates.RxRate.Add(rxRate);
}