예제 #1
0
        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 );
        }
예제 #2
0
 private SiteMapNodeCreateDisplay ToCreateDisplay( SiteMapNodeCreateInput input )
 {
     return Mapper.Map<SiteMapNodeCreateInput, SiteMapNodeCreateDisplay>( input );
 }
예제 #3
0
 private static SiteMapNode ToModel( SiteMapNodeCreateInput input )
 {
     return Mapper.Map<SiteMapNodeCreateInput, SiteMapNode>( input );
 }