public EditablePresentViewModel(IPresentRepository presentRepository, Present present, PresentList list)
        {
            _presentRepository = presentRepository;
            _present = present;
            _list = list;

            SaveCommand = new RelayCommand(SavePresent);
        }
        public PresentListViewModel(PresentList presentList, IPresentListRepository listRepository, IViewModelFactory viewModelFactory)
        {
            _presentList = presentList;
            _listRepository = listRepository;
            _viewModelFactory = viewModelFactory;

            EditCommand = new RelayCommand(EditList);
            AddPresentCommand = new RelayCommand(AddPresent);
        }
        public EditableListViewModel(IPresentListRepository listRepository, PresentList list)
        {
            _listRepository = listRepository;
            _list = list;

            SaveCommand = new RelayCommand(SavePresent, CanSavePresent);

            BeginEdit();
        }
 public virtual void Save(PresentList presentList)
 {
     using (ISession session = _sessionManager.OpenSession())
     {
         try
         {
             session.SaveOrUpdate(presentList);
         }
         catch (HibernateException e)
         {
             Console.WriteLine(e.Message);
             throw new RepositoryException();
         }
     }
 }
 public void Save(Present present, PresentList list)
 {
     using (var session = _sessionManager.OpenSession())
     {
         try
         {
             list.AddPresent(present);
             session.SaveOrUpdate(present);
         }
         catch (HibernateException he)
         {
             Logger.Error(he.Message, he);
             throw new RepositoryException();
         }
     }
 }
 public void BeginEdit()
 {
     _originalList = new PresentList
     {
         Name = _list.Name,
         Notes = _list.Notes
     };
 }
 public void EndEdit()
 {
     _originalList = null;
 }
 public PresentListOverviewViewModel(PresentList presentList)
 {
     _presentList = presentList;
 }