Beispiel #1
0
        public ActionResult ViewChannels()
        {
            if (TempData["islemSonucu"] != null)
            {
                ViewBag.Sonuc = TempData["islemSonucu"];
            }

            if (Session["user"] != null)
            {
                User current = Session["user"] as User;
                return(View(cr.GetChannelsByID(current.UserID, false, false)));
            }
            else
            {
                return(RedirectToAction("NotFound", "Home"));
            }
        }
Beispiel #2
0
        public ActionResult ViewProfile(int id = 0)
        {
            UserRepo ur = new UserRepo();

            if (id < 1)
            {
                if (Session["user"] != null)
                {
                    User           current   = Session["user"] as User;
                    ChannelRepo    cr        = new ChannelRepo();
                    List <Channel> chsOfUser = cr.GetChannelsByID(current.UserID, false);
                    return(View(Tuple.Create <User, List <Channel> >(current, chsOfUser)));
                }
                else
                {
                    return(RedirectToAction("NotFound", "Home"));
                }
            }
            else
            {
                try
                {
                    User           current   = ur.GetUserByID(Convert.ToInt32(id));
                    ChannelRepo    cr        = new ChannelRepo();
                    List <Channel> chsOfUser = cr.GetChannelsByID(current.UserID, false);
                    return(View(Tuple.Create(current, chsOfUser)));
                }
                catch (FormatException)
                {
                    return(RedirectToAction("NotFound", "Home"));
                }
                catch (NullReferenceException)
                {
                    return(RedirectToAction("NotFound", "Home"));
                }
            }
        }