public ActionResult Save(string userName, int userAge, string subscription) { if (ModelState.IsValid) { if (CustomerTabelHelper.DoseCustomerExists(userName)) { TempData["errorName"] = "Name already exist, try another one"; return(View("New")); } else { CustomerTabelHelper.InsertNewCustomer(userName, userAge, subscription); return(RedirectToAction("Index")); } } else { TempData["error"] = "You must fill in all the fields!!"; return(View("New")); } }
public ActionResult Index() { List <Customer> list = CustomerTabelHelper.GetCustomersList(); return(View(list)); }