public async Task<string> Post(ScoreEntry value) { if (value != null) { database.Add(value); await database.SaveChangesAsync(); return "Success"; } else { return "Failed"; } }
public async Task<IActionResult> Submit(ScoreEntry entry) { // Check if the result is valid if (!ModelState.IsValid) { return View(entry); } // Save the entry asynchronously database.Add(entry); await database.SaveChangesAsync(); // Redirect to the Entry Action with an Anonymous Parameter that Entry() needs return RedirectToAction("Index"); }
public void Add(ScoreEntry entry) { Entries.Add(entry); updateOrderedList(); }