public ActionResult CustomerCreate(CCustomer c) { List <CCustomer> lsCustomers = CCustomerFactory.fn顧客查詢(); CCustomer ccustomer = lsCustomers.FirstOrDefault(m => m.fCustomerEmail == c.fCustomerEmail); CCustomerFactory.fn顧客新增(c); ViewBag.message = "新增成功"; return(View()); }
public ActionResult CustomerEdit(CCustomerEditor c) { List <CCustomer> lsCustomers = CCustomerFactory.fn顧客查詢(); CCustomer ccustomer = lsCustomers.FirstOrDefault(m => m.fCustomerId == c.fCustomerId); var data = ""; if (ccustomer != null) { ccustomer.fCustomerName = c.fCustomerName; ccustomer.fCustomerBirth = c.fCustomerBirth; ccustomer.fCustomerGender = c.fCustomerGender; ccustomer.fCustomerEmail = c.fCustomerEmail; ccustomer.fCustomerAddress = c.fCustomerAddress; ccustomer.fCustomerPhone = c.fCustomerPhone; CCustomerFactory.fn顧客更新(ccustomer); return(RedirectToAction("CustomerEdit")); } else { return(RedirectToAction("CustomerData")); } }
public ActionResult CustomerDelete(CCustomer c) { CCustomerFactory.fn顧客刪除(c); return(View()); }
public ActionResult CustomerData() { var customerdata = CCustomerFactory.fn顧客查詢().ToList(); return(View(customerdata)); }