Exemplo n.º 1
0
        /// <summary>
        ///     deletes the testvalue
        /// </summary>
        /// <param name="testValueId">id of the testvalue</param>
        /// <returns>The deleted testvalue</returns>
        public TestValue Delete(Int32 testValueId)
        {
            var result = TestBll.DeleteTestValue(testValueId);

            BabyDiaperRetentionServiceHelper.UpdateRetentionAverageAndStv(result.TestSheetId);
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Saves or updates the BabyDiaperRetentionEditViewModel
        /// </summary>
        /// <param name="viewModel">The viewmodel which will be saved or updated</param>
        /// <returns>The saved or updated BabyDiaperRetentionEditViewModel</returns>
        public TestValue Save(BabyDiaperRetentionEditViewModel viewModel)
        {
            TestValue testValue;

            try
            {
                testValue = viewModel.TestValueId <= 0
                    ? BabyDiaperRetentionServiceHelper.SaveNewRetentionTest(viewModel)
                    : BabyDiaperRetentionServiceHelper.UpdateRetentionTest(viewModel);
                BabyDiaperRetentionServiceHelper.UpdateRetentionAverageAndStv(viewModel.TestSheetId);
            }
            catch (Exception e)
            {
                Logger.Error("Update oder Create new Test Value ist fehlgeschlagen: " + e.Message);
                testValue = null;
            }
            return(testValue);
        }