public TaskListItemViewModel Edit(TaskEditModel editModel) { Task task = _taskDAO.Get(editModel.Id); TimeSpan allowedExposureTime = new TimeSpanFactory().CreateFromStrings(editModel.Hours, editModel.Minutes); task.Title = editModel.Title; task.NoiseLevelGuideline = Convert.ToDecimal(editModel.NoiseLevelGuideline.Trim(), new CultureInfo("en-US")); task.AllowedExposureMinutes = Convert.ToInt32(allowedExposureTime.TotalMinutes); task.Role = _roleDAO.Get(editModel.RoleId); task.NoiseProtection = _noiseProtectionDAO.Get(editModel.NoiseProtectionId); task.ButtonPressed = editModel.ButtonPressed; task.Frequency = editModel.Frequency; _taskDAO.Store(task); TaskListItemViewModel viewModel = CreateTaskListItemViewModel(task); return(viewModel); }