示例#1
0
 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"));
     }
 }
示例#2
0
        public ActionResult Index()
        {
            List <Customer> list = CustomerTabelHelper.GetCustomersList();

            return(View(list));
        }