public ActionResult insertcus(customer p) { customerfactory y = new customerfactory(); y.Insert(p); return(RedirectToAction("List")); }
public ActionResult delete(int fId) { customerfactory y = new customerfactory(); y.del(fId); return(RedirectToAction("List")); }
public string deltest(int id) { customerfactory x = new customerfactory(); x.del(id); return("del success"); }
public ActionResult edit(customer p) { if (!string.IsNullOrEmpty(p.name)) { return(RedirectToAction("List")); } customerfactory y = new customerfactory(); y.changes(p); return(RedirectToAction("List")); }
// GET: api/surface1 public IEnumerable <customer> Get() { customer[] c = new customerfactory().getall(); foreach (customer cc in c) { cc.password = "******"; cc.phone = cc.phone.Substring(0, 3) + "***"; } return(c); //return customerfactory().getall(); }
public ActionResult bindCustomerbyId(int?id) //如果沒有輸入id 加? { if (id == null) { return(View()); } customer x = new customerfactory().getbyId((int)id); return(View(x)); }
public string changetest() { customer x = new customer(); x.id = 4; x.name = "幹"; customerfactory y = new customerfactory(); y.changes(x); return("ovo"); }
public ActionResult edit(int fId) { customerfactory y = new customerfactory(); customer x = y.getbyId(fId); if (x == null) { return(RedirectToAction("List")); } return(View(x)); }
public string inserttest() { customer x = new customer(); x.name = "歐"; x.phone = "0123456"; x.email = "owo@com"; x.address = "ooo"; customerfactory y = new customerfactory(); y.Insert(x); return("成功"); }
public string findCustomerbyId(int?id) //如果沒有輸入id 加? { if (id == null) { return("安安"); } customer x = new customerfactory().getbyId((int)id); if (x == null) { return("查無資料"); } return(x.name + "/" + x.phone); }
public ActionResult showCustomerbyId(int?id) //如果沒有輸入id 加? { if (id == null) { return(View()); } customer x = new customerfactory().getbyId((int)id); if (x != null) { ViewBag.vid = x.id.ToString(); ViewBag.vname = x.name; ViewBag.vemail = x.email; ViewBag.vaddress = x.address; ViewBag.vphone = x.phone; } return(View()); }
public string findCustomerbykeyword(string keyword) //如果沒有輸入id 加? { string html = "<table border='1'>"; html += "<tr>"; html += "<td>編號</td>"; html += "<td>名稱</td>"; html += "<td>電話</td>"; html += "<td>郵件</td>"; html += "<td>地址</td>"; html += "</tr>"; if (string.IsNullOrEmpty(keyword)) { return(html += "</table>"); } customer[] x = new customerfactory().getbykeyword(keyword); if (x == null) { return("查無資料"); } foreach (customer c in x) { html += "<tr>"; html += "<td>" + c.id.ToString() + "</td>"; html += "<td>" + c.name + "</td>"; html += "<td>" + c.phone + "</td>"; html += "<td>" + c.email + "</td>"; html += "<td>" + c.address + "</td>"; html += "</tr>"; } return(html + "</table>"); }
// GET: customer public ActionResult List() { customerfactory x = new customerfactory(); return(View(x.getall())); }