Exemple #1
0
        /* ---------------------------------------------------------------------------------------------------------- */

        #region Private Methods

        /// <summary>
        /// Creates a new row in the database.
        /// </summary>
        private SaveResult CreateNavItem(NavigationModel model, ContentManagementDb db)
        {
            try
            {
                DomainNavigationItem navItem = new DomainNavigationItem();
                navItem.Initialise();

                AutoMap.Map(model, navItem);

                int domainId = UserSession.Current.DomainId;
                navItem.DomainId = domainId;

                navItem.Ordinal = db.DomainNavigationItems.Where(s => s.DomainId == domainId && s.IsDeleted == false).Select(s => s.Ordinal).Max() + 1;

                db.DomainNavigationItems.Add(navItem);

                db.SaveChanges();

                return(SaveResult.Success);
            }
            catch
            {
                return(SaveResult.Fail);
            }
        }
Exemple #2
0
        /* ---------------------------------------------------------------------------------------------------------- */

        #region Private Methods

        /// <summary>
        /// Creates a new row in the database.
        /// </summary>
        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);
            }
        }