public NotesVM() { NewNoteCommand = new NewNoteCommand(this); NewNotebookCommand = new NewNotebookCommand(this); ExitCommand = new ExitCommand(this); DeleteNoteCommand = new DeleteNoteCommand(this); DeleteNotebookCommand = new DeleteNotebookCommand(this); RenameNoteCommand = new RenameNoteCommand(this); RenameNotebookCommand = new RenameNotebookCommand(this); SaveNoteContentCommand = new SaveNoteContentCommand(this); Notes = new ObservableCollection <Note>(); Notebooks = new ObservableCollection <Notebook>(); //TODO: Implement genuine login functionality. CurrentUser = new User() { Id = 1, FirstName = "Alex", LastName = "Barker", Username = "******", Email = "*****@*****.**", Password = "******" }; ReadNotebooks(); }
public async Task Handle_NoteNotFound_ShouldThrowNotFoundException() { // Arrange var note = await _wolkDbContext.CreateAndSaveNote(); var request = new DeleteNotebookCommand(note.Id + 1); // Act / Assert await Assert.ThrowsExceptionAsync <NotFoundException>(() => _handler.Handle(request, CancellationToken.None)); }
public NotesVM() { NewNotebookCommand = new NewNotebookCommand(this); NewNoteCommand = new NewNoteCommand(this); DeleteNotebookCommand = new DeleteNotebookCommand(this); NoteBooks = new ObservableCollection <Notebook>(); Notes = new ObservableCollection <Note>(); // get all the notebooks into a listview on page load GetNotebooks(); }
public NotesVM() { NewNoteCommand = new NewNoteCommand(this); NewNotebookCommand = new NewNotebookCommand(this); Notebooks = new ObservableCollection <Notebook>(); Notes = new ObservableCollection <Note>(); EditCommand = new EditCommand(this); EndEditCommand = new EndEditCommand(this); DeleteNotebookCommand = new DeleteNotebookCommand(this); DeleteNoteCommand = new DeleteNoteCommand(this); IsVisible = Visibility.Collapsed; GetNotebooks(); }
public async Task Handle_NoteFound_ShouldDeleteNote() { // Arrange var note = await _wolkDbContext.CreateAndSaveNote(); var request = new DeleteNotebookCommand(note.Id); // Act await _handler.Handle(request, CancellationToken.None); // Assert Assert.IsFalse(await _wolkDbContext.Notes.AnyAsync()); }
public NotesVM() { IsEditing = false; NewNotebookCommand = new NewNotebookCommand(this); NewNoteCommand = new NewNoteCommand(this); BeginEditCommand = new BeginEditCommand(this); HasEditedCommand = new HasEditedCommand(this); DeleteNotebookCommand = new DeleteNotebookCommand(this); Notebooks = new ObservableCollection <Notebook>(); Notes = new ObservableCollection <Note>(); ReadNotebooks(); ReadNotes(); }
//đã check public NoteVM() { //TODO: IsEditing = false; NewNotebookCommand = new NewNotebookCommand(this); NewNoteCommand = new NewNoteCommand(this); BeginEditCommand = new BeginEditCommand(this); HasEditingCommand = new HasEditingCommand(this); DeleteNotebookCommand = new DeleteNotebookCommand(this); RefreshCommmand = new RefreshCommmand(this); Notebooks = new ObservableCollection <Notebook>(); Notes = new ObservableCollection <Note>(); //chú thích lỗi nếu người dùng chưa tạo notebook nào thì dòng này không được thức hiện ReadNotebooks(); ReadNote(); }
public NotesViewModel() { IsEditedNotebook = false; NewNotebookCommand = new NewNotebookCommand(this); NewNoteCommand = new NewNoteCommand(this); beginEditCommand = new BeginEditCommand(this); hasEditedCommand = new HasEditedCommand(this); deleteNotebookCommand = new DeleteNotebookCommand(this); deleteNoteCommand = new DeleteNoteCommand(this); Notebooks = new ObservableCollection <Notebook>(); Notes = new ObservableCollection <Note>(); ReadNotebooks(); ReadNote(); }
public NotesVM() { IsEditing = false; IsNoteEditing = false; NewNotebookCommand = new NewNotebookCommand(this); NewNoteCommand = new NewNoteCommand(this); RenameNoteBookCommand = new RenameNoteBookCommand(this); HasNotebookRenamedCommand = new HasNotebookRenamedCommand(this); DeleteNotebookCommand = new DeleteNotebookCommand(this); RenameNoteCommand = new RenameNoteCommand(this); HasNoteRenamedCommand = new HasNoteRenamedCommand(this); DeleteNoteCommand = new DeleteNoteCommand(this); Notebooks = new ObservableCollection <NoteBook>(); Notes = new ObservableCollection <Note>(); ReadNoteBooks(); ReadNotes(); }
public NotesVM() { IsEditing = false; IsEditingNote = false; NewNotebookCommand = new NewNotebookCommand(this); NewNoteCommand = new NewNoteCommand(this); DeleteNotebookCommand = new DeleteNotebookCommand(this); DeleteNoteCommand = new DeleteNoteCommand(this); BeginEditCommand = new BeginEditCommand(this); IsEditedCommand = new IsEditedCommand(this); BeginEditNoteCommand = new BeginEditNoteCommand(this); IsEditedNoteCommand = new IsEditedNoteCommand(this); Notebooks = new ObservableCollection <Notebook>(); Notes = new ObservableCollection <Note>(); FontSizes = new List <double>() { 8, 9, 10, 11, 12, 14, 16, 28, 48, 72 }; ReadNotebooks(); ReadNotes(); }
internal IResult Execute(IContractKey contractKey, out int?contractId) { contractId = null; var key = new ContractKey(contractKey); var contract = _salesUnitOfWork.ContractRepository .FindByKey(key, c => c.ContractItems, c => c.Comments, c => c.Comments.Notes, c => c.ContractItems.Select(i => i.OrderItems)); if (contract == null) { return(new InvalidResult(string.Format(UserMessages.CustomerContractNotFound, key.KeyValue))); } if (contract.ContractItems.SelectMany(i => i.OrderItems).Any()) { return(new InvalidResult(string.Format(UserMessages.CustomerContractHasOrderItems, key.KeyValue))); } contractId = contract.ContractId; var deleteNotebookResult = new DeleteNotebookCommand(_salesUnitOfWork).Delete(contract.Comments); if (!deleteNotebookResult.Success) { return(deleteNotebookResult); } var contractItems = contract.ContractItems.ToList(); foreach (var item in contractItems) { _salesUnitOfWork.ContractItemRepository.Remove(item); } _salesUnitOfWork.ContractRepository.Remove(contract); return(new SuccessResult()); }