diff options
| author | Jason Lepp <jlepp@arcresources.com> | 2010-10-18 14:08:44 -0600 |
|---|---|---|
| committer | Jason Lepp <jlepp@arcresources.com> | 2010-10-18 14:08:44 -0600 |
| commit | f7ec4f2fb5afd60d1995a9204a01c650363d851e (patch) | |
| tree | 51ca3a9c11607da8a1dba6b6ea958e9ab822f3f0 | |
| parent | 07c518957ec11f336b7e3c8304b8eca20d4d6aba (diff) | |
Remove unneccesary Updates and Fix edge case on date in MVVM
| -rw-r--r-- | src/MVPtoMVVM.mvvm/viewmodels/MainWindowViewModel.cs | 3 | ||||
| -rw-r--r-- | src/MVPtoMVVM.mvvm/viewmodels/ToDoItemViewModel.cs | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/MVPtoMVVM.mvvm/viewmodels/MainWindowViewModel.cs b/src/MVPtoMVVM.mvvm/viewmodels/MainWindowViewModel.cs index 78509f1..51e2adf 100644 --- a/src/MVPtoMVVM.mvvm/viewmodels/MainWindowViewModel.cs +++ b/src/MVPtoMVVM.mvvm/viewmodels/MainWindowViewModel.cs @@ -38,8 +38,7 @@ namespace MVPtoMVVM.mvvm.viewmodels private void AddNewItem()
{
- TodoItems.Add(new TodoItemViewModel(todoItemRepository){Parent = this});
- updater.Update(x => x.TodoItems);
+ TodoItems.Add(new TodoItemViewModel(todoItemRepository){Parent = this, DueDate = DateTime.Today, Description = string.Empty});
}
private TodoItemViewModel MapFrom(TodoItem x)
diff --git a/src/MVPtoMVVM.mvvm/viewmodels/ToDoItemViewModel.cs b/src/MVPtoMVVM.mvvm/viewmodels/ToDoItemViewModel.cs index 90ab367..eced3da 100644 --- a/src/MVPtoMVVM.mvvm/viewmodels/ToDoItemViewModel.cs +++ b/src/MVPtoMVVM.mvvm/viewmodels/ToDoItemViewModel.cs @@ -22,7 +22,7 @@ namespace MVPtoMVVM.mvvm.viewmodels validations = new Dictionary<string, IValidation>
{
{"Description", new Validation(() => !string.IsNullOrEmpty(Description), "Cannot have an empty description.")},
- {"DueDate", new Validation(() => DueDate >= DateTime.Now, "Due Date must occur on or after today.")}
+ {"DueDate", new Validation(() => DueDate >= DateTime.Today, "Due Date must occur on or after today.")}
};
}
@@ -30,7 +30,6 @@ namespace MVPtoMVVM.mvvm.viewmodels {
todoItemRepository.Delete(Id);
Parent.TodoItems.Remove(this);
- Parent.Update(x => x.TodoItems);
}
private bool CanSave()
|
