public PresetCreationViewModel()
        {
            presetNameColor          = Brushes.Black;
            this.MeasurementTypeList = new Collection <MeasurementType>();

            /* Loading measurementtypes from db */
            IMeasurementTypeDao           measurementDao   = AdoFactory.Instance.GetMeasurementTypeDao("wetr");
            IEnumerable <MeasurementType> measurementTypes = measurementDao.FindAllAsync().Result;

            foreach (MeasurementType t in measurementTypes)
            {
                this.MeasurementTypeList.Add(t);
            }
            this.SelectedMeasurementType = this.MeasurementTypeList[0];

            /* Init Dates */
            this.StartDate = DateTime.Now;
            this.endDate   = DateTime.Now.AddMonths(2);

            /* Init preset list */
            this.PresetList = new ObservableCollection <Preset>();

            /* Add preset command */
            AddPreset = new RelayCommand(
                ExecuteAddPreset,
                CanExecuteAddPreset
                );

            /* Remove preset command */
            DeletePreset = new RelayCommand(
                ExecuteDeletePreset,
                CanExecuteDeletePreset
                );
        }
        public async override Task TestFindAllAsync()
        {
            IEnumerable <MeasurementType> fetchesMeasurementTypes = await measurementTypeDao.FindAllAsync();

            foreach (MeasurementType t in measurementTypes)
            {
                CollectionAssert.Contains(fetchesMeasurementTypes.ToList(), t);
            }
        }
Esempio n. 3
0
        public async Task <IHttpActionResult> GetMeasuremenetTypes()
        {
            IMeasurementTypeDao dao = AdoFactory.Instance.GetMeasurementTypeDao("wetr");

            return(Ok(await dao.FindAllAsync()));
        }