示例#1
0
        public static void AddPage(CMSDatabase db, PageModel model, HttpContext context, out bool successfullyCompleted)
        {
            Page page = PagesManagementFunctions.PageModelToPage(db, model, context);

            if (page == null)
            {
                successfullyCompleted = false;
                return;
            }
            db.Add(page);
            db.SaveChanges();
            model.ID = page.ID;
            successfullyCompleted = true;

            LogManagementFunctions.AddAdminPanelLog(
                db: db,
                context: context,
                info: $"{page.PageName} (ID-{page.ID.ToString()}): " +
                (page is UsualPage ? (context.Items["LogLocalization"] as IAdminPanelLogLocalization)?.PageAdded
                : (context.Items["LogLocalization"] as IAdminPanelLogLocalization)?.CategoryAdded)
                );
        }