예제 #1
0
 public ActionResult Show(int id = 0)
 {
     if (id != 0)
     {
         Live live = new Live();
         live = db.Lives.Find(id);
         ViewBag.ShowLive = live;
     }
     else
     {
         Live live = new Live();
         live.LiveURL = "rtmp://218.8.130.128:1935/Live/Video1";
         live.Title = "测试";
         ViewBag.ShowLive = live;
     }
     ViewBag.LiveID = id;
     return View();
 }
예제 #2
0
 public ActionResult AddLive(Live model, HttpPostedFileBase file)
 {
     if (file != null)
     {
         System.IO.Stream stream = file.InputStream;
         byte[] buffer = new byte[stream.Length];
         stream.Read(buffer, 0, (int)stream.Length);
         stream.Close();
         model.Picture = buffer;
         db.Lives.Add(model);
         db.SaveChanges();
         return Redirect("/Admin/LiveManager");
     }
     else
     {
         return Redirect("/Admin/AdminMessage?msg=你填写信息不正确,请重新填写!");
     }
 }
예제 #3
0
 public ActionResult LiveEdit(Live model, HttpPostedFileBase file)
 {
     Live live = db.Lives.Find(model.ID);
     if (file != null)
     {
         System.IO.Stream stream = file.InputStream;
         byte[] buffer = new byte[stream.Length];
         stream.Read(buffer, 0, (int)stream.Length);
         stream.Close();
         live.Picture = buffer;
     }
     live.Title = model.Title;
     live.Description = model.Description;
     live.Begin = model.Begin;
     live.End = model.End;
     live.LiveURL = model.LiveURL;
     live.NeedAuthorize = model.NeedAuthorize;
     db.SaveChanges();
     return Redirect("/Admin/LiveManager");
 }
예제 #4
0
 /// <summary>
 /// 视频缩略图
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult ShowPicture(int id)
 {
     Live live = new Live();
     live = db.Lives.Find(id);
     return File(live.Picture, "image/jpg");
 }