public IActionResult Create(Account dto) { if (ModelState.IsValid) { var storedAccounts = GetStoredAccounts(); storedAccounts.Add(dto); storedAccounts.Sort((a1, a2) => a1.Name.CompareTo(a2.Name)); HttpContext.Session.SetObjectAsJson("accounts", storedAccounts); return RedirectToAction("Index"); } return View(dto); }
public IActionResult Create() { var dto = new Account(); return View(dto); }