コード例 #1
0
        public ActionResult CreateContent(string selectedProfile)
        {
            var model = new ContentGridModel();

            GetAllProfiles(model);

            model.ProfileId = Convert.ToInt32(selectedProfile);

            var content = new ContentItem { ProfileList = model.ProfileList };
            if (HttpContext.Request.UrlReferrer != null)
            {
                content.ReturnUrl = HttpContext.Request.UrlReferrer.ToString();
            }

            return View("CreateContent", content);
        }
コード例 #2
0
        private void GetAllProfiles(ContentGridModel model)
        {
            var profiles = _reader.GetProfiles().OrderBy(x => x.Name).ToList();
            var allProfiles = profiles.Select(c => new SelectListItem
            {
                Text = c.Name.ToString(CultureInfo.InvariantCulture),
                Value = c.Id.ToString(CultureInfo.InvariantCulture)
            });

            model.ProfileList = allProfiles;
            var firstOrDefault = model.ProfileList.FirstOrDefault();
            if (firstOrDefault != null)
            {
                model.ProfileId = Convert.ToInt32(firstOrDefault.Value);
            }
        }
コード例 #3
0
        public ActionResult ContentIndex()
        {
            var model = new ContentGridModel
            {
                SortBy = "Sequence",
                SortAscending = true,
                CurrentPageIndex = 1,
                PageSize = 100
            };

            GetAllProfiles(model);

            var profileId = Request.Params["profileId"];
            if (profileId != null)
            {
                model.ProfileId = int.Parse(profileId);
            }

            GetContentItems(model);
            return View(model);
        }
コード例 #4
0
 private void GetContentItems(ContentGridModel profiles)
 {
     profiles.ContentItems = _reader.GetProfileContentItems(profiles.ProfileId);
 }
コード例 #5
0
        public ActionResult ReloadContentItems(string selectedProfile)
        {
            var model = new ContentGridModel();

            GetAllProfiles(model);

            model.ProfileId = Convert.ToInt32(selectedProfile);
            GetContentItems(model);

            return View("ContentIndex", model);
        }