Ejemplo n.º 1
0
        //------------------ADMIN

        #region ADMIN

        /// <summary>
        /// Controller-method for the AdminFrontPage view.
        /// </summary>
        /// <returns>AdminFrontPage view</returns>
        public ActionResult AdminFrontPage()
        {
            try
            {
                #region IsAdminCheck

                if (Session["Kunde"] == null)
                {
                    return(RedirectToAction("Frontpage", "Film"));
                }

                var user   = (UserVM)Session["Kunde"];
                int userId = user.Id;
                if (!_UserLogic.IsAdmin(userId))
                {
                    return(RedirectToAction("Frontpage", "Film"));
                }

                #endregion IsAdminCheck

                AdminFrontPageVM frontPageVM = _menyLogic.GetFrontPageVM();
                return(View(frontPageVM));
            }
            catch (DatabaseErrorException e)
            {
                return(RedirectToAction("ShowMessage", "Home", new
                {
                    header = "Noe gikk galt under opprettelsen av kunden!", message = e.GetMessage()
                }));
            }
        }