public virtual ActionResult Create( SiteMapNodeCreateInput input ) { if ( ModelState.IsValid ) { try { SiteMapNode model = ToModel( input ); if ( input.PreviousSiblingId.HasValue ) { SiteMapNodeService.InsertAfterNode( model, input.PreviousSiblingId.Value ); } else { SiteMapNodeService.InsertUnderNode( model, input.ParentId ); } return this.RedirectToAction( x => x.Index() ); } catch ( Exception ex ) { // todo display error ErrorLogHelper.Log( ex ); throw; // todo remove } } SiteMapNodeCreateDisplay display = ToCreateDisplay( input ); PopulateCreateDisplay( display ); return View( display ); }
private SiteMapNodeCreateDisplay ToCreateDisplay( SiteMapNodeCreateInput input ) { return Mapper.Map<SiteMapNodeCreateInput, SiteMapNodeCreateDisplay>( input ); }
private static SiteMapNode ToModel( SiteMapNodeCreateInput input ) { return Mapper.Map<SiteMapNodeCreateInput, SiteMapNode>( input ); }