public TextNoteViewModel(TextNoteModel model = null) { Model = model ?? new TextNoteModel(); DeleteCommand = new RelayCommand(RemoveNote); ArchiveCommand = new RelayCommand(ArchiveNote); EditCommand = new RelayCommand(EditNote); }
/// <summary> /// Создает текстовую заметку /// </summary> /// <param name="note">Данные для создания заметки</param> /// <returns></returns> public async Task <bool> AddNote(TextNoteModel note) { var parameters = new Dictionary <string, string> { { "title", note.Title }, { "content", note.Content }, { "backgroundcolor", note.BackgroundColor.ToHex() } }; var response = await apiClient.CallAsync(AddTextNoteMethod, parameters); return(response["successful"]); }
private async Task MakeDemoNote() { // Необязательный шаг, но все равно int count = await apiClient.Notes.GetCount(); if (count <= 0) { var note = new TextNoteModel { Title = "Привет мир!", Content = "Это моя первая заметка.", BackgroundColor = Color.Purple }; await apiClient.Notes.AddNote(note); } }