示例#1
0
        public ActionResult Edit(Customer customer)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    int id = Convert.ToInt32(Session["CustomerId"]);
                    CustomerDB.EditCustomer(id, customer);

                    // function for adding AgentId dropdown - commented out for later enabling
                    //AgentIdList = new SelectList(CustomerDB.GetAgentIdDropdown(), Convert.ToString(customer.AgentId), Convert.ToString(customer.AgentId), Convert.ToInt32(customer.AgentId));
                    //ViewBag.AgentIdList = AgentIdList;

                    return(RedirectToAction("Details"));
                }
                catch
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }
        }
 public ActionResult Edit(Customer customer)
 {
     if (ModelState.IsValid)
     {
         try
         {
             int id = Convert.ToInt32(Session["CustomerId"]);
             CustomerDB.EditCustomer(id, customer);
             return(RedirectToAction("Details"));
         }
         catch
         {
             return(View());
         }
     }
     else
     {
         return(View());
     }
 }