public ActionResult Submit(Clip model) { // Save url to database if (ModelState.IsValid) { string a = "https://clips.twitch.tv/embed?clip="; string b = model.Code; // 4/5/ words from url string c = "&parent=localhost&autoplay=false&muted=false"; string src = a + b + c; var table = new TwitchEntitiesEntities(); table.Clips.Add(new Clip { Code = src }); table.SaveChanges(); ViewData["Message"] = "Video Submitted"; } else { ViewData["Message"] = "ModelState.IsValid Error"; } // Clear the textbox return(View(model)); }
public ActionResult Watch() { // get src if (ModelState.IsValid) { var entities = new TwitchEntitiesEntities(); int count = entities.Clips.Count(); // apply to iframe return(View(entities.Clips.ToList())); } else { ViewBag["Message"] = "error with modelstate"; return(RedirectToAction("Submit", "ULUL")); } }