public IActionResult Process(UserQuotes data) { string query = $"INSERT INTO userquotes (name, quote) VALUES ('{data.Name}', '{data.Quote}')"; DbConnector.Execute(query); ViewData["Message"] = "Quote added to the database!"; return(RedirectToAction("Index")); }
public IActionResult Create(UserQuotes data) { if (!ModelState.IsValid) { return(View("Index")); } else { string query = $"INSERT INTO userquotes (name, quote, created_at, updated_at) VALUES ('{data.Name}', '{data.Quote}', NOW(), NOW());"; DbConnector.Execute(query); ViewData["Message"] = "Quote added to the database!"; return(RedirectToAction("Quotes")); } }