public HomeController(ITemperatureUnit temperatureUnit, ICity _city) { temperature = temperatureUnit; city = _city; if (city.Lat.Equals("0") && city.Lon.Equals("0")) { city.setDefault(); } }
private string GetValue(string text, string unitOfMeasurement1, string unitOfMeasurement2) { if (unitOfMeasurement1 == "" || unitOfMeasurement2 == "") { return(""); } ITemperatureUnit from = temperatureUnits.First(n => n.Name == unitOfMeasurement1); ITemperatureUnit to = temperatureUnits.First(n => n.Name == unitOfMeasurement2); return(Convert.ToString(to.ConvertFromCelsius(from.ConvertToCelsius(Convert.ToDouble(text))))); }
// GET: /<controller>/ public ForecastController(ICity _city, ITemperatureUnit temperature) { temperatureUnit = temperature; city = _city; }