private void Add() { Console.WriteLine("New Journal Entry"); Journal journal = new Journal(); while (true) { Console.Write("Title: "); string resp = Console.ReadLine(); if (resp.Length > 55) { Console.WriteLine("Journal titles must be less than 55 characters."); } else { journal.Title = resp; break; } } Console.Write("Content: "); journal.Content = Console.ReadLine(); journal.CreateDateTime = DateTime.Now; _journalRepository.Insert(journal); }
private void Add() { Console.WriteLine("New Journal Entry"); Journal journal = new Journal(); Console.WriteLine("Please enter in the Title of the new entry"); string title = Console.ReadLine(); if (!string.IsNullOrEmpty(title)) { journal.Title = title; } else { Console.WriteLine("You must enter in a Title"); return; } Console.WriteLine("Please enter the journal entry"); string content = Console.ReadLine(); if (!string.IsNullOrEmpty(content)) { journal.Content = content; } else { Console.WriteLine("You must enter in content for your entry"); return; } journal.CreateDateTime = DateTime.Now; _journalRepository.Insert(journal); }
private void Add() { Console.WriteLine("New Journal Entry:"); Journal jEntry = new Journal(); Console.Write("Title: "); jEntry.Title = Console.ReadLine(); Console.Write("Content: "); jEntry.Content = Console.ReadLine(); _journalRepository.Insert(jEntry); }
//Adding New Journal Entry private void Add() { Console.WriteLine("New Journal Entry"); Journal journal = new Journal(); Title: Console.Write("Title: "); journal.Title = Console.ReadLine(); //Preventing Empty User Input For Title if (journal.Title == "") { Console.WriteLine(); Console.WriteLine("Please enter a title for this journal entry."); Console.WriteLine(); goto Title; } //Catch for user entering a title that exceeds the varchar limit set inside the database else if (journal.Title.Length > 55) { Console.WriteLine(); Console.WriteLine("The title you entered is too long. Please try something shorter."); Console.WriteLine(); goto Title; } if (journal.Title == "") { Console.WriteLine(); Console.WriteLine("Please enter a title for this journal entry."); Console.WriteLine(); goto Title; } Content: Console.Write("Content: "); journal.Content = Console.ReadLine(); //Preventing Empty User Input For Content if (journal.Content == "") { Console.WriteLine(); Console.WriteLine("Please add content to this journal entry."); Console.WriteLine(); goto Content; } journal.CreateDateTime = DateTime.Now; _journalRepository.Insert(journal); }
private void Add() { Console.WriteLine("New Journal Entry"); Journal entry = new Journal(); Console.Write("Title: "); entry.Title = Console.ReadLine(); Console.Write("Content: "); entry.Content = Console.ReadLine(); entry.CreateDateTime = DateTime.Now; _journalRepository.Insert(entry); }
private void Add() { Console.WriteLine("New Journal Entries"); Journal journal = new Journal(); Console.Write("Title: "); journal.Title = Console.ReadLine(); Console.Write("Content: "); journal.Content = Console.ReadLine(); journal.CreateDateTime = DateTime.Now; _journalRepository.Insert(journal); }
private void Add() { Console.WriteLine("\nNew Journal"); Journal journal = new Journal(); Console.Write("\nTitle: "); journal.Title = Console.ReadLine(); Console.Write("\nContent: "); journal.Content = Console.ReadLine(); Console.Write("\nCreateDateTime: "); journal.CreateDateTime = Convert.ToDateTime(Console.ReadLine()); _journalRepository.Insert(journal); }
//Add a new journal private void Add() { Console.WriteLine("New Journal"); Journal journal = new Journal(); Console.Write("Entry Title: "); journal.Title = Console.ReadLine(); journal.CreateDateTime = DateTime.Now; Console.WriteLine(); Console.WriteLine("What's on your mind? "); journal.Content = Console.ReadLine(); _journalRepository.Insert(journal); }
//Adding a new journal entry. User is prompted to enter in data that will be stored in variables. //Current time will be saved with data. Then it will be inserted into the database. private void Add() { Console.WriteLine("New Journal Entry"); Journal journal = new Journal(); Console.WriteLine("Title: "); journal.Title = Console.ReadLine(); Console.WriteLine("Content: "); journal.Content = Console.ReadLine(); Console.WriteLine("Your journal entry time will be saved at the current time."); journal.CreateDateTime = DateTime.Now; _journalRepository.Insert(journal); }
private void Add() { Console.WriteLine("New Journal"); Journal journal = new Journal(); Console.WriteLine("Title: "); journal.Title = Console.ReadLine(); Console.WriteLine("Text Content: "); journal.Content = Console.ReadLine(); //make this an auto time setter Console.WriteLine("Date: "); journal.CreateDateTime = DateTime.Now; _JournalRepository.Insert(journal); }
private void Add() { Console.WriteLine("New Journal Entry"); Journal journal = new Journal(); Console.Write("Title: "); journal.Title = Console.ReadLine(); Console.Write("Content: "); journal.Content = Console.ReadLine(); Console.WriteLine($"Your entry has been saved."); Console.Write("Press any key to continue"); Console.ReadKey(); DateTime dateTime = DateTime.Now; journal.CreateDateTime = dateTime; _journalRepository.Insert(journal); }
private void Add() { Console.WriteLine("New Journal Entry"); JournalEntry entry = new JournalEntry(); Console.Write("Title: "); entry.Title = Console.ReadLine(); Console.WriteLine("Content: "); entry.Content = ""; string content = Console.ReadLine(); while (!string.IsNullOrWhiteSpace(content)) { entry.Content += content + "\n"; content = Console.ReadLine(); } entry.CreateDateTime = DateTime.Now; _journalRepository.Insert(entry); }
private void Add() { Journal journal = new Journal(); Console.WriteLine("-------------------"); Console.WriteLine("***New Journal Entry***"); Console.WriteLine("What's the title of this entry? "); journal.Title = Console.ReadLine(); while (journal.Title == "") { Console.WriteLine("***You must input a title***"); Console.WriteLine("What's the title of this entry?"); journal.Title = Console.ReadLine(); } while (journal.Title.Length > 55) { Console.WriteLine("***You cannot exceed 55 characters for the title. Please shorten your title***"); Console.WriteLine("What's the title of this entry? "); journal.Title = Console.ReadLine(); } Console.Write("What do you have to say today? "); journal.Content = Console.ReadLine(); while (journal.Content == "") { Console.WriteLine("You must input content"); Console.Write("What do you have to say today? "); journal.Content = Console.ReadLine(); } journal.CreateDateTime = DateTime.Now; _journalRepository.Insert(journal); }