Example #1
0
        public void PopulateCombos()
        {
            var types = _repo.GetAllCompoundTypes();

            ViewBag.Types = types;

            var names = _repo.GetAllElements();

            ViewBag.ElementNames = names;
        }
        public ActionResult GetAll(TemperatureType type)
        {
            Log.Information("GET Element/GetAll triggered");

            var elements = _repo.GetAllElements();

            //Map to DTO object
            var elementDtos = Mapper.Map <List <ElementDto> >(elements);

            //Recalculate temperature
            if (type != TemperatureType.Kelvin)
            {
                foreach (var element in elementDtos)
                {
                    element.BoilingTemperature = TemperatureConverter.Convert(element.BoilingTemperature, type);
                }
            }

            return(Json(elementDtos, JsonRequestBehavior.AllowGet));
        }