Exemplo n.º 1
0
        public ActionResult insertcus(customer p)
        {
            customerfactory y = new customerfactory();

            y.Insert(p);
            return(RedirectToAction("List"));
        }
Exemplo n.º 2
0
        public ActionResult delete(int fId)
        {
            customerfactory y = new customerfactory();

            y.del(fId);
            return(RedirectToAction("List"));
        }
Exemplo n.º 3
0
        public string deltest(int id)
        {
            customerfactory x = new customerfactory();

            x.del(id);
            return("del success");
        }
Exemplo n.º 4
0
        public ActionResult edit(customer p)
        {
            if (!string.IsNullOrEmpty(p.name))
            {
                return(RedirectToAction("List"));
            }
            customerfactory y = new customerfactory();

            y.changes(p);
            return(RedirectToAction("List"));
        }
Exemplo n.º 5
0
 // 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();
 }
Exemplo n.º 6
0
        public ActionResult bindCustomerbyId(int?id)     //如果沒有輸入id  加?
        {
            if (id == null)
            {
                return(View());
            }
            customer x = new customerfactory().getbyId((int)id);


            return(View(x));
        }
Exemplo n.º 7
0
        public string changetest()
        {
            customer x = new customer();

            x.id   = 4;
            x.name = "幹";
            customerfactory y = new customerfactory();

            y.changes(x);
            return("ovo");
        }
Exemplo n.º 8
0
        public ActionResult edit(int fId)
        {
            customerfactory y = new customerfactory();

            customer x = y.getbyId(fId);

            if (x == null)
            {
                return(RedirectToAction("List"));
            }
            return(View(x));
        }
Exemplo n.º 9
0
        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("成功");
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        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());
        }
Exemplo n.º 12
0
        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>");
        }
Exemplo n.º 13
0
        // GET: customer
        public ActionResult List()
        {
            customerfactory x = new customerfactory();

            return(View(x.getall()));
        }