public ActionResult Cbanner(string txt_banner, HttpPostedFileBase txt_file)
 {
     Banner b = new Banner();
     b.BMemo = txt_banner;
     //檢查是否有選擇檔案
     if (txt_file != null)
     {
         //檢查檔案大小要限制也可以在這裡做
         if (txt_file.ContentLength > 0)
         {
             string savedName = Path.Combine(Server.MapPath("~/images/Banner/"), txt_file.FileName);
             txt_file.SaveAs(savedName);
         }
     }
     if (txt_file == null)
     {
         b.BImg = "~/images/example_img.jpg";
     }
     else
     {
         b.BImg = "~/images/Banner/" + txt_file.FileName;
     }
     BannerData bd = new BannerData();
     bd.Create(b);
     return RedirectToAction("Conter", new { tabid = "2", m = "2" });
 }
        public ActionResult Ubanner(string id, string txt_banner, HttpPostedFileBase txt_file)
        {
            Banner b = new Banner();
            BannerData bd = new BannerData();
            b.Bid = Convert.ToInt32(id);
            b.BMemo = txt_banner;
            //檢查是否有選擇檔案
            if (txt_file != null)
            {
                //檢查檔案大小要限制也可以在這裡做
                if (txt_file.ContentLength > 0)
                {
                    string savedName = Path.Combine(Server.MapPath("~/images/Banner/"), txt_file.FileName);
                    txt_file.SaveAs(savedName);
                }
                b.BImg = "~/images/Banner/" + txt_file.FileName;
            }
            //if (txt_file == null)
            //{
            //    b.BImg = "~/images/example_img.jpg";
            //}
            else
            {
                b.BImg = bd.GetImg_One(b);
                //"~/images/Banner/" + txt_file.FileName;
            }

            bd.Update(b);
            return RedirectToAction("Conter", new { tabid = "2", m = "2" });
        }
 public ActionResult Dbanner(string id)
 {
     if (Session["Member"] == null)
     {
         return RedirectToAction("login");
     }
     Banner b = new Banner();
     b.Bid = Convert.ToInt32(id);
     BannerData bd = new BannerData();
     bd.Delete(b);
     return RedirectToAction("Conter", new { tabid = "2", m = "2" });
 }