Beispiel #1
0
        public ActionResult chanlist()
        {
            ViewBag.addfavorite = db.channels.Select(f => new SelectListItem {
                Value = f.channelid.ToString(), Text = f.name
            });
            personchannel favorite = new personchannel();

            return(View(favorite));
        }
Beispiel #2
0
        public ActionResult chanlist(personchannel favorite)
        {
            var Usr = Convert.ToInt32(Session["id"]);

            try
            {
                personchannel newfavorite = new personchannel();
                newfavorite.FK_channelid = favorite.FK_channelid;
                newfavorite.FK_personid  = Usr;
                db.personchannels.Add(newfavorite);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(RedirectToAction("MyPage", "Home"));
        }