public void SetItem(TodoItem item)
 {
     Id = item.Id;
     Description = item.Description;
     DueDate = item.DueDate;
     IsDirty = false;
 }
 public void Save(TodoItem item)
 {
     if (item.Id == 0)
         AddItem(item);
     else
     {
         UpdateItem(item);
     }
 }
 private TodoItemViewModel MapFrom(TodoItem item)
 {
     return new TodoItemViewModel(todoItemRepository)
                {
                    Id = item.Id,
                    Description =  item.Description,
                    DueDate = item.DueDate,                                                                        
                    Parent = this,
                    IsDirty = false,
                };
 }
 private void UpdateItem(TodoItem item)
 {
     var oldItem = items.Single(x => x.Id == item.Id);
     items.Remove(oldItem);
     items.Add(item);
 }
 private void AddItem(TodoItem item)
 {
     totalItems++;
     item.Id = totalItems;
     items.Add(item);
 }
 public void Delete(TodoItem item)
 {
     Delete(item.Id);
 }
Example #7
0
 private ITodoItemPresenter MapFrom(TodoItem todoItem)
 {
     return new TodoItemPresenter(itemRepository) { Description = todoItem.Description, DueDate = todoItem.DueDate, Id = todoItem.Id };
 }