public OhmValuesModel GetResistanceValue(OhmBandsModel ohmBands)
        {
            try
            {
                using (var context = new ElectronicsCalculatorDbContext())
                {
                    LaResistance   laResistance = new LaResistance(ohmBands);
                    OhmValuesModel ohmValues    = new OhmValuesModel
                    {
                        ohms = laResistance.ohms,
                        low  = laResistance.ohmsLow,
                        high = laResistance.ohmsHigh
                    };

                    return(ohmValues);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#2
0
        /// <summary>
        /// This constructor method will only set ohms value property
        /// </summary>
        /// <param name="model"></param>
        public LaResistance(OhmBandsModel model)
        {
            CodedResistance calc = new CodedResistance();

            ohms = calc.CalculateOhmValue(model.bandAColor, model.bandBColor, model.bandCColor, model.bandDColor);
        }