// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; namespace Demo.Controllers { public class TestController : Controller { public ActionResult List() { return View(DB.GetAll()); } public ActionResult Add(IFormCollection frmcol) { string f1 = (string)frmcol["f1"]; string f2 = (string)frmcol["f2"]; string f3 = (string)frmcol["f3"]; DB.SaveOne(new T1 { F1 = int.Parse(f1), F2 = f2, F3 = f3 }); return RedirectToAction("List"); } } }