Esempio n. 1
0
        /// <summary>
        /// Save all change to database
        /// </summary>
        /// <returns></returns>
        public bool Save()
        {
            //try
            //{
            var orgSlug = this.Model.Slug;
            var newSlug = this.Slug;

            this.CopyTo(Model, "Scripts", "StyleSheets", "Roles");
            Context.Update(Model);
            var count = Context.SaveChanges() > 0;

            if (!orgSlug.Equals(newSlug, StringComparison.OrdinalIgnoreCase))
            {
                var orgUrl = _GenUrl(orgSlug);
                var newUrl = _GenUrl(newSlug);
                var saver  = new UrlSaver(Context);
                saver.Rename(orgUrl, newUrl);
            }

            return(count);
            //}
            //catch (System.ObjectDisposedException e)
            //{
            //    this.Model = Context.Find<WebPage>(this.ID);
            //    return Save();
            //}
        }
Esempio n. 2
0
        /// <summary>
        /// Save all change to database
        /// </summary>
        /// <returns></returns>
        public bool Save()
        {
            //try
            //{
            var orgSlug = this.Model.Slug;
            var newSlug = this.Slug;

            this.CopyTo(Model, "Scripts", "StyleSheets", "Roles");
            Context.Update(Model);
            var count = Context.SaveChanges() > 0;

            if (!orgSlug.Equals(newSlug, StringComparison.OrdinalIgnoreCase))
            {
                var orgUrl = _GenUrl(orgSlug);
                var newUrl = _GenUrl(newSlug);
                var saver = new UrlSaver(Context);
                saver.Rename(orgUrl, newUrl);
            }

            return count;
            //}
            //catch (System.ObjectDisposedException e)
            //{
            //    this.Model = Context.Find<WebPage>(this.ID);
            //    return Save();
            //}
        }