コード例 #1
0
        /// <summary>
        /// gets the detail of a banner
        /// </summary>
        /// <param name="id">identifier of banner</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int?id)
        {
            BannerRepository   objbanner         = new BannerRepository(SessionCustom);
            SectionManagement  objsection        = new SectionManagement(SessionCustom, HttpContext);
            SectionRepository  sectionrepository = new SectionRepository(SessionCustom);
            PositionRepository objposition       = new PositionRepository(SessionCustom);

            Domain.Entities.Banner banner = null;
            bool?isHome = null;

            if (id != null)
            {
                objbanner.Entity.BannerId = id;
                objbanner.Load();
                banner     = objbanner.Entity;
                ViewBag.id = id;

                BannersectionRepository objbannersection = new BannersectionRepository(SessionCustom);
                objbannersection.Entity.BannerId = id;

                List <Bannersection> collsections = objbannersection.GetAll();
                objsection.CreateTreeViewCheck(sectionrepository.GetAll().FindAll(t => t.LanguageId == CurrentLanguage.LanguageId), collsections);
                isHome = collsections.Exists(t => t.SectionId == 0);
            }
            else
            {
                objsection.CreateTreeViewCheck(sectionrepository.GetAll().FindAll(t => t.LanguageId == CurrentLanguage.LanguageId), null);
            }

            return(this.View(new Banners()
            {
                UserPrincipal = CustomUser,
                Banner = banner,
                ColModul = CustomMemberShipProvider.GetModuls(CustomUser.UserId, SessionCustom, HttpContext),
                Module = this.Module,
                TreeView = objsection.Tree,
                Collposition = objposition.GetAll(),
                IsHome = isHome,
                CurrentLanguage = CurrentLanguage
            }));
        }