private void AddQuote() { Console.WriteLine("Enter quote:"); string text = Console.ReadLine(); Console.WriteLine("Enter Samurai ID:"); _quoteRepo.AddQuote(text, Convert.ToInt32(Console.ReadLine())); Run(); }
public ActionResult Create(Quote newQuote, IFormCollection collection) { if (!ModelState.IsValid) { return(View(newQuote)); } try { _quotesRepo.AddQuote(newQuote); return(RedirectToAction(nameof(Index))); } catch { return(View(newQuote)); } }
public async Task AddQuote(string author, int year, [Remainder] string quoteText) { Quote quote = new Quote() { Author = author, YearOfQuote = year, QuoteText = quoteText, ServerId = GetServerId() }; try { _repo.AddQuote(quote, GetServerId()); await ReplyAsync($"Quotes by {quote.Author} was successfully added."); } catch (Exception e) { await ReplyAsync(e.Message); } }
public Quote AddQuote(Quote quote) { return(_quoteRepo.AddQuote(quote)); }