예제 #1
0
 public Repository()
 {
     if (Customer == null) {
         Customer = new Customer {
             FirstName = "Eric",
             LastName = "Siebeneich",
             PhoneNumber = "1234567890"
         };
     }
 }
        public ActionResult Create(Customer collection)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
 public ActionResult Edit(int id, FormCollection collection)
 {
     try
     {
         Customer c = new Customer();
         c.FirstName = collection["FirstName"];
         c.LastName = collection["LastName"];
         c.PhoneNumber = collection["PhoneNumber.area"] + collection["PhoneNumber.next3"] + collection["PhoneNumber.last4"];
         // TODO: Add update logic here
         Repository.Customer = c;
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }