public ActionResult Create(tbl_product tbl_product)
        {
            if (ModelState.IsValid)
            {
                tbl_product.product_status = true;
                tbl_product.create_time = DateTime.Now;
                //处理长链接为短连接 获取二维码 并存储
                string webUrl = "";

                webUrl = Config.ConfigManager.getConfig("get-ticket-url");
                webUrl = webUrl.Replace("EVENT_ID", "" + tbl_product.product_id);
                WebRequest webRequest = WebRequest.Create(webUrl);
                HttpWebRequest request = webRequest as HttpWebRequest;
                request.Method = "GET";
                WebResponse response = request.GetResponse();
                String ticketUrl = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd();
                tbl_product.ticket_url = ticketUrl;

                webUrl = Config.ConfigManager.getConfig("get-short-url");
                byte[] dataArray = Encoding.UTF8.GetBytes(tbl_product.content_url);
                webRequest = WebRequest.Create(webUrl);
                request = webRequest as HttpWebRequest;
                request.Method = "POST";
                request.ContentLength = dataArray.Length;
                Stream dataStream = request.GetRequestStream();
                dataStream.Write(dataArray, 0, dataArray.Length);
                dataStream.Close();

                response = request.GetResponse();
                String shortUrl = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd();
                tbl_product.short_url = shortUrl;

                db.tbl_product.AddObject(tbl_product);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(tbl_product);
        }
 /// <summary>
 /// 创建新的 tbl_product 对象。
 /// </summary>
 /// <param name="product_id">product_id 属性的初始值。</param>
 /// <param name="product_name">product_name 属性的初始值。</param>
 /// <param name="description">description 属性的初始值。</param>
 /// <param name="create_time">create_time 属性的初始值。</param>
 /// <param name="push_level">push_level 属性的初始值。</param>
 public static tbl_product Createtbl_product(global::System.Int32 product_id, global::System.String product_name, global::System.String description, global::System.DateTime create_time, global::System.SByte push_level)
 {
     tbl_product tbl_product = new tbl_product();
     tbl_product.product_id = product_id;
     tbl_product.product_name = product_name;
     tbl_product.description = description;
     tbl_product.create_time = create_time;
     tbl_product.push_level = push_level;
     return tbl_product;
 }
 public ActionResult Edit(tbl_product tbl_product)
 {
     if (ModelState.IsValid)
     {
         db.tbl_product.Attach(tbl_product);
         db.ObjectStateManager.ChangeObjectState(tbl_product, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(tbl_product);
 }
 /// <summary>
 /// 用于向 tbl_product EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddTotbl_product(tbl_product tbl_product)
 {
     base.AddObject("tbl_product", tbl_product);
 }