Exemple #1
0
 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);
 }
Exemple #2
0
        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);
        }