本文整理汇总了C#中Umbraco.Web.Models.RenderModel类的典型用法代码示例。如果您正苦于以下问题:C# RenderModel类的具体用法?C# RenderModel怎么用?C# RenderModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RenderModel类属于Umbraco.Web.Models命名空间,在下文中一共展示了RenderModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Frontpage
public ActionResult Frontpage(RenderModel model)
{
IPublishedContent page = model.Content;
FrontpageRenderModel newModel = new FrontpageRenderModel(page);
newModel.Header = page.GetPropertyValue<string>("header");
newModel.Bodytext = page.GetPropertyValue<IHtmlString>("bodyText");
newModel.CreateReviewUserForm = new CreateReviewUserForm();
var slideFolder = Umbraco.TypedMedia(page.GetPropertyValue<int>("slideFolder"));
if (slideFolder != null)
{
List<Slide> slides = new List<Slide>();
foreach (var image in slideFolder.Children)
{
Slide s = new Slide();
s.ImageUrl = image.Url;
slides.Add(s);
}
newModel.Slides = slides;
}
//Do some stuff here, then return the base method
return View(newModel);
}
开发者ID:Tjornfelt,项目名称:ScrumPower2,代码行数:28,代码来源:FrontpageController.cs
示例2: Index
public override ActionResult Index(RenderModel model)
{
if (model.Content.TemplateId.Equals(Template.GetTemplateIdFromAlias("ProjectCreate")))
{
var member = Member.GetCurrentMember();
if (member != null)
{
if (Request.HttpMethod.Equals("GET"))
return CurrentTemplate(model);
var project = CreateProject(member);
if (project != null) return this.Redirect(umbraco.library.NiceUrl(project.Id));
}
return this.Redirect(Request.UrlReferrer.AbsoluteUri);
}
else
{
var id = Convert.ToInt32(Request.Params["id"]);
var project = new Document(id);
var member = Member.GetCurrentMember();
var authorId = project.getProperty("author").Value;
if (member != null && member.Id.Equals(authorId))
{
if (Request.HttpMethod.Equals("GET"))
return base.View(model);
SaveProject(project, member);
}
return this.Redirect(umbraco.library.NiceUrl(id));
}
}
开发者ID:v-five,项目名称:upgradeit,代码行数:34,代码来源:ProjectController.cs
示例3: Index
/// <summary>
/// The index <see cref="ActionResult"/>.
/// </summary>
/// <param name="model">
/// The current render model.
/// </param>
/// <returns>
/// The <see cref="ActionResult"/>.
/// </returns>
public override ActionResult Index(RenderModel model)
{
// Create the viewmodel
var viewModel = ViewModelFactory.CreateProduct(model);
return this.View(viewModel.ThemeViewPath("Product"), viewModel);
}
开发者ID:Teknyc,项目名称:Merchello,代码行数:16,代码来源:BazaarProductController.cs
示例4: Fruit
public ActionResult Fruit(RenderModel model, string slug)
{
if (string.IsNullOrEmpty(slug))
{
return null;
}
else
{
foreach (var node in model.Content.Children)
{
var potentialUrls = new List<string>();
var v = new VortoApiController();
var langs = (List<Our.Umbraco.Vorto.Models.Language>)v.GetInstalledLanguages();
foreach (var lang in langs)
{
var vortoValue = node.GetVortoValue<string>("fruitName", lang.IsoCode);
if (!string.IsNullOrEmpty(vortoValue))
{
potentialUrls.Add(vortoValue.ToUrlSegment());
}
}
if (potentialUrls.Contains(slug))
{
// match
return this.View("~/Views/Fruit.cshtml", this.CreateRenderModel(node));
}
}
return this.HttpNotFound();
}
}
开发者ID:Jeavon,项目名称:FunWithVirtualContent,代码行数:33,代码来源:FruitsController.cs
示例5: Index
//
// GET: /Home/
public override ActionResult Index(RenderModel model)
{
HomeModel customModel = new HomeModel(model);
customModel.Message = "Hello world from HomeController";
//customModel.SearchTerm = string.Empty;
return CurrentTemplate(customModel);
}
开发者ID:WebdevWizards,项目名称:UmbracoMvc5.0,代码行数:10,代码来源:HomeController.cs
示例6: Index
//
// GET: /Movies/
public override ActionResult Index(RenderModel model)
{
INode currentNode = Node.GetCurrent();
var newsItem = ModelFactory.CreateModel<MoviesRazor.Models.NewsItem>(currentNode);
newsItem.DisplayDate = newsItem.Date.ToString("dd MMMM yyyy");
return CurrentTemplate(newsItem);
}
开发者ID:pdebacker,项目名称:UmbCodeGen_Example_Project_Razor,代码行数:9,代码来源:NewsItemController.cs
示例7: Index
//
// Note:
// the Index method handles the inital page GET request and the Ajax POST request
// on which a filtered result is returned. It is a simple approach to handle an Ajax
// request with little effort. A better option might be to use a SurfaceController.
// However, this example is about to show the Umbraco Code Generation possibilities
// and is not about showing the best practices using Umbraco MVC.
//
public override ActionResult Index(RenderModel model)
{
if (Request.HttpMethod.Equals("GET"))
{
INode currentNode = Node.GetCurrent();
var moviesPage = new MoviesPage();
moviesPage.Movies = ModelFactory.CreateModel<MoviesRazor.Models.Movies>(currentNode);
INode genresNode = Node.GetNodeByXpath("//Genres");
moviesPage.Genres = ModelFactory.CreateModel<Genres>(genresNode);
return CurrentTemplate(moviesPage);
}
else
{
int genreId = int.Parse(Request.QueryString["genreId"]);
INode currentNode = Node.GetCurrent();
var movies = ModelFactory.CreateModel<MoviesRazor.Models.Movies>(currentNode);
movies.MovieListItems = movies.MovieListItems.Where(l => l.Genre.NodeId == genreId).ToList();
return PartialView("MoviesList", movies);
}
}
开发者ID:pdebacker,项目名称:UmbCodeGen_Example_Project_Razor,代码行数:33,代码来源:MoviesController.cs
示例8: Container__5Childs_PageSize4__Page2_Returns_1_Item
public void Container__5Childs_PageSize4__Page2_Returns_1_Item()
{
//1. Arrange
var mSite = new Mock<ISiteRepository>();
var mController = new Mock<ContainerBaseController>(mSite.Object) { CallBase = true }; //abstract class callBase
var mContent = Arrange.Content("lorem parent page",
new List<IPublishedContent>()
{
{ Arrange.Content("Lorem child page 1").Object },
{ Arrange.Content("Ipsum child page 2").Object },
{ Arrange.Content("Dolor child page 3").Object },
{ Arrange.Content("Sit child page 4").Object },
{ Arrange.Content("Consectetur child page 5").Object }
});
var renderModel = new RenderModel(mContent.Object, CultureInfo.InvariantCulture);
//2.Act
var result = mController.Object.Container(renderModel,
p: 2,
s: 4) as ViewResult;
//3. Assert.
Assert.IsTrue((result.Model as DynamicCollectionModel).TotalResults == 5, "Total results does not contain 5 items");
Assert.IsTrue((result.Model as DynamicCollectionModel).Results.Count() == 1, "Resultset for page 2 does not contain the correct amount of items");
}
开发者ID:joosthollander,项目名称:Macaw.Umbraco.Foundation,代码行数:27,代码来源:ContainerBaseControllerTest.cs
示例9: SubMenu
public ActionResult SubMenu(RenderModel model)
{
var contentSubMenu = model.Content.Children.FirstOrDefault(node => node.DocumentTypeAlias.Equals("ContentSubMenu"));
if (contentSubMenu == null)
return base.Index(model);
return Redirect(contentSubMenu.Url);
}
开发者ID:nicolasmetaye,项目名称:DynamicLoopCompany,代码行数:7,代码来源:SubMenuController.cs
示例10: Index
public override ActionResult Index(RenderModel model)
{
ContactOperationStatus operationStatus = _contactService.GetContact();
ContactViewModel viewContact = new ContactViewModel(model);
if (operationStatus.Status)
{
viewContact.InjectFrom(operationStatus.Contact);
viewContact.ExistingUserName = operationStatus.Contact.UserName;
viewContact.ExistingEmail = operationStatus.Contact.Email;
if (!String.IsNullOrEmpty(Request["url"]))
{
viewContact.Url = Request["url"];
}
if (!String.IsNullOrEmpty(Umbraco.Field("checkoutPage").ToString()))
viewContact.Url = Umbraco.Field("checkoutPage").ToString();
viewContact.Titles = GetContactTitles();
viewContact.Countries = GetCountries();
viewContact.Status = operationStatus.Status;
viewContact.Message = operationStatus.Message;
return CurrentTemplate(viewContact);
}
return ReturnErrorView(operationStatus, model);
}
开发者ID:jamesdrever,项目名称:cpx,代码行数:25,代码来源:CpxMaintainContactController.cs
示例11: Index
public ActionResult Index(RenderModel model, long p = 1)
{
var typedModel = model.Content.As<TextPageViewModel>();
typedModel.Title = "[Overwritten] " + typedModel.Title;
return CurrentView(typedModel);
}
开发者ID:webmonger,项目名称:umbraco-ditflo,代码行数:7,代码来源:UmbTextPageController.cs
示例12: Index
public override ActionResult Index(RenderModel model)
{
INode currentNode = Node.GetCurrent();
var cinemas = ModelFactory.CreateModel<Cinemas>(currentNode);
return CurrentTemplate(cinemas);
}
开发者ID:pdebacker,项目名称:UmbCodeGen_Example_Project_Razor,代码行数:7,代码来源:CinemasController.cs
示例13: Index
public override ActionResult Index(RenderModel model)
{
var products = model.Content.Children();
var viewModel = new ProductFolderViewModel();
foreach (var productContent in products)
{
var productModel = new ProductViewModel();
productModel.Content= productContent.GetPropertyValue<string>("bodyText")
.ScrubHtml()
.Truncate(200, true, true);
productModel.UrlName = productContent.UrlName;
productModel.Title = productContent.Name;
productModel.NumberOfComments = productContent.Descendants("Comment").Count();
viewModel.Products.Add(productModel);
}
if (Request.IsAjaxRequest())
{
return Json(viewModel);
}
ViewBag.Model = viewModel;
//Do some stuff here, then return the base method
return base.Index(model);
}
开发者ID:christofur,项目名称:Umbraco-React-Starter-kit,代码行数:29,代码来源:ProductsFolderController.cs
示例14: Index
//
// GET: /Movies/
public override ActionResult Index(RenderModel model)
{
INode currentNode = Node.GetCurrent();
var news = ModelFactory.CreateModel<MoviesRazor.Models.NewsPage>(currentNode);
FormatDates(news.NewsListItems);
return CurrentTemplate(news);
}
开发者ID:pdebacker,项目名称:UmbCodeGen_Example_Project_Razor,代码行数:9,代码来源:NewsPageController.cs
示例15: Show
/// <summary>
/// Used to render the Members profile (virtual node)
/// </summary>
/// <param name="model"></param>
/// <param name="membername">
/// The slug which we use to look up the member
/// </param>
/// <param name="p"></param>
/// <returns></returns>
public ActionResult Show(RenderModel model, string membername, int? p = null)
{
var memPage = model.Content as DialogueVirtualPage;
if (memPage == null)
{
throw new InvalidOperationException("The RenderModel.Content instance must be of type " + typeof(DialogueVirtualPage));
}
if (string.IsNullOrEmpty(membername))
{
return ErrorToHomePage(Lang("Errors.GenericMessage"));
}
using (UnitOfWorkManager.NewUnitOfWork())
{
var member = ServiceFactory.MemberService.GetUserBySlug(membername, true);
var loggedonId = UserIsAuthenticated ? CurrentMember.Id : 0;
var viewModel = new ViewMemberViewModel(model.Content)
{
User = member,
LoggedOnUserId = loggedonId,
PageTitle = string.Concat(member.UserName, Lang("Members.ProfileTitle")),
PostCount = member.PostCount
};
// Get the topic view slug
return View(PathHelper.GetThemeViewPath("MemberProfile"), viewModel);
}
}
开发者ID:ryan-buckman,项目名称:Dialogue,代码行数:38,代码来源:DialogueMemberController.cs
示例16: Index
public virtual ActionResult Index(RenderModel model) //Template name, default is Index
{
var ret = new DynamicModel(model.Content, Repository);
//todo: multiple cultures?
return View(ret);
}
开发者ID:joosthollander,项目名称:Macaw.Umbraco.Foundation,代码行数:8,代码来源:DynamicBaseController.cs
示例17: Tags
/// <summary>
/// Used to render the tag listing (virtual node)
/// </summary>
/// <param name="model"></param>
/// <param name="tag">The tag to display if supplied</param>
/// <param name="p"></param>
/// <returns></returns>
public ActionResult Tags(RenderModel model, string tag, int? p)
{
var tagurlName = model.Content.GetPropertyValue<string>("tagsUrlName");
return tag.IsNullOrWhiteSpace()
? RenderTagsOrCategories(model, "ArticulateTags", tagurlName)
: RenderByTagOrCategory(model, p, "ArticulateTags", tagurlName);
}
开发者ID:efabioli,项目名称:Articulate,代码行数:15,代码来源:ArticulateTagsController.cs
示例18: Index
/// <summary>
/// The index.
/// </summary>
/// <param name="model">
/// The model.
/// </param>
/// <returns>
/// The <see cref="ActionResult"/>.
/// </returns>
public override ActionResult Index(RenderModel model)
{
var viewModel = ViewModelFactory.CreateProductCollection(model);
viewModel.SpecifyCulture(UmbracoContext.PublishedContentRequest.Culture);
return this.View(viewModel.ThemeViewPath("ProductCollection"), viewModel);
}
开发者ID:drpeck,项目名称:Merchello,代码行数:17,代码来源:BazaarProductCollectionController.cs
示例19: Index
public override ActionResult Index(RenderModel model)
{
// use Ditto to get strongly typed model
model = new RenderModel(model.Content.As<EventPage>());
// pass model to template/view
return base.Index(model);
}
开发者ID:jannikanker,项目名称:UmbracoMvcHelpers,代码行数:8,代码来源:EventPageController.cs
示例20: Index
/// <summary>
/// The index <see cref="ActionResult"/>.
/// </summary>
/// <param name="model">
/// The current render model.
/// </param>
/// <returns>
/// The <see cref="ActionResult"/>.
/// </returns>
public override ActionResult Index(RenderModel model)
{
var invoices = _merchello.Query.Invoice.GetByCustomerKey(CurrentCustomer.Key);
//// TODO currency codes need to be determined by invoice as they no longer should be assoicated with the global setting
var viewModel = ViewModelFactory.CreateAccountHistory(model, invoices);
return this.View(viewModel.ThemeAccountPath("History"), viewModel);
}
开发者ID:drpeck,项目名称:Merchello,代码行数:17,代码来源:BazaarAccountHistoryController.cs
注:本文中的Umbraco.Web.Models.RenderModel类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论