public void FromKilograms(WeightData weightData) { if (!weightData.HasKg) { return; } weightData.Lbs = weightData.Kg.Value * KgToPounds; weightData.St = Math.Floor(weightData.Lbs.Value / 14); weightData.StLbs = weightData.Lbs.Value - (weightData.St.Value * 14); }
public WeightData Calculate(WeightData weightData) { switch (weightData.Units) { case "kg": FromKilograms(weightData); break; case "lbs": FromPounds(weightData); break; case "st": FromStoneAndPounds(weightData); break; } return(weightData); }