public ActionResult Create([Bind(Include = "Id,ChannelName")] Channel channel) { if (ModelState.IsValid) { db.Channel.Add(channel); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(channel)); }
public ActionResult Create([Bind(Include = "Id,ProgramName,Time,Date,ChannelId,Category,Length,Info")] Program program) { if (ModelState.IsValid) { db.Program.Add(program); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ChannelId = new SelectList(db.Channel, "Id", "ChannelName", program.ChannelId); return(View(program)); }
public ActionResult DeleteFavorite(string uname, string pword, int channl) { DataBaseTvEntities db = new DataBaseTvEntities(); string chn = GetChannel(channl); int cid = GetCid(uname, GetChannel(channl)); if (ModelState.IsValid) { var del = (from c in db.PersonalList where c.Id == cid select c).FirstOrDefault(); db.PersonalList.Remove(del); db.SaveChanges(); } ProgramsController pc = new ProgramsController(); var proglist = pc.SendList(); PersonalListsController pl = new PersonalListsController(); var plist = pl.SendList(); List <ProgramVM> personlist = new List <ProgramVM>(); var dateAndTime = DateTime.Now; var datee = dateAndTime.Date; ViewBag.UserName = uname; ViewBag.PassWord = pword; foreach (var l in plist) { foreach (var p in proglist) { string x = GetChannel(p.ChannelId.Value); if (l.Channel == GetChannel(p.ChannelId.Value) && l.Username == uname) { ProgramVM o = new ProgramVM(); if (p.Date == datee) { o.Id = p.Id; o.ProgramName = p.ProgramName; o.Time = p.Time; o.ChannelId = p.ChannelId.Value; o.Date = p.Date; o.Length = p.Length; o.Info = p.Info; personlist.Add(o); } } } } return(RedirectToAction("PrivateList", new { uname, pword })); }
public ActionResult AddedFavorite(string uname, string pword, string channl) { DataBaseTvEntities db = new DataBaseTvEntities(); if (ModelState.IsValid) { PersonalList perlis = new PersonalList() { Username = uname, Channel = channl }; db.PersonalList.Add(perlis); db.SaveChanges(); ViewBag.UserName = uname; ViewBag.PassWord = pword; return(RedirectToAction("AddFavorite", new { uname, pword })); } return(View()); }