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); }
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); } }
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); }
private void GetContentItems(ContentGridModel profiles) { profiles.ContentItems = _reader.GetProfileContentItems(profiles.ProfileId); }
public ActionResult ReloadContentItems(string selectedProfile) { var model = new ContentGridModel(); GetAllProfiles(model); model.ProfileId = Convert.ToInt32(selectedProfile); GetContentItems(model); return View("ContentIndex", model); }