Пример #1
0
        public ActionResult Create(Theme theme)
        {
            //check if Theme name or folder is dupe for this client
            ValidateThemeName(theme);

            if (ModelState.IsValid)
            {
                theme = GStoreDb.Themes.Create(theme);
                theme.UpdateAuditFields(CurrentUserProfileOrThrow);
                theme = GStoreDb.Themes.Add(theme);
                AddUserMessage("Theme Added", "Theme '" + theme.Name.ToHtml() + "' [" + theme.ThemeId + "] created successfully!", UserMessageType.Success);
                GStoreDb.SaveChanges();

                return RedirectToAction("Index");
            }
            int? clientId = null;
            if (theme.ClientId != default(int))
            {
                clientId = theme.ClientId;
            }

            this.BreadCrumbsFunc = htmlHelper => this.ThemeBreadcrumb(htmlHelper, theme.ClientId, theme, false);
            return View(theme);
        }
Пример #2
0
        public ActionResult Edit(Theme theme)
        {
            ValidateThemeName(theme);

            if (ModelState.IsValid)
            {
                theme.UpdateAuditFields(CurrentUserProfileOrThrow);
                theme = GStoreDb.Themes.Update(theme);
                AddUserMessage("Theme Updated", "Theme '" + theme.Name.ToHtml() + "' [" + theme.ThemeId + "] updated successfully!", UserMessageType.Success);
                GStoreDb.SaveChanges();

                return RedirectToAction("Index");
            }

            this.BreadCrumbsFunc = htmlHelper => this.ThemeBreadcrumb(htmlHelper, theme.ClientId, theme, false);
            return View(theme);
        }