예제 #1
0
        public ActionResult GetCustomer(UpdateCustomer newCust)
        {
            string username = (string)Session["Username"];

            try
            {
                UpdateCustomer oldCust = CustomersDB.GetCustomer(username);
                //Thread.Sleep(10000)
                int count = CustomersDB.UpdateCustomer(oldCust, newCust);
                if (count == 0)// no update due to concurrency issue
                {
                    TempData["errorMessage"] = "Update aborted. " +
                                               "Another user changed or deleted this row";
                }
                else
                {
                    TempData["errorMessage"] = "";
                }
                return(RedirectToAction("Index", "Home"));
            }
            catch
            {
                return(View());
            }
        }
예제 #2
0
        //GET
        //Retrieves existing customer from the database Author Stephen Sander
        public ActionResult GetCustomer(string username)
        {
            username = (string)Session["Username"];
            UpdateCustomer oldCust = CustomersDB.GetCustomer(username);

            return(View(oldCust));
        }