private SaveResult UpdateNavItem( DomainNavigationItem navItem, NavigationModel model, ContentManagementDb db ) { if ( UserSession.Current.IsAdministrator == false ) return SaveResult.AccessDenied; if ( UserSession.Current.CurrentDomain( db ).CanAccess( navItem ) == false ) return SaveResult.IncorrectDomain; try { AutoMap.Map( model, navItem ); navItem.UpdateTimeStamp(); db.SaveChanges(); return SaveResult.Success; } catch { return SaveResult.Fail; } }
private SaveResult CreateNavItem( NavigationModel model, ContentManagementDb db ) { try { DomainNavigationItem navItem = new DomainNavigationItem(); navItem.Initialise(); AutoMap.Map( model, navItem ); navItem.DomainId = UserSession.Current.DomainId; db.DomainNavigationItems.Add( navItem ); db.SaveChanges(); return SaveResult.Success; } catch { return SaveResult.Fail; } }
public NavigationModel( DomainNavigationItem navItem ) { AutoMap.Map( navItem, this ); }