Esempio n. 1
0
        public ActionResult NewTextContent(TextContent content)
        {
            if (ValidationUtility.AreNotNullOrWhitespace(content.Key, content.Value))
            {
                Database.Instance.SaveNew(content);
            }

            return(RedirectToAction(nameof(Settings)));
        }
Esempio n. 2
0
        public ActionResult UpdateTextContent(string emailSubject, string emailContent, string pageContent)
        {
            if (ValidationUtility.AreNotNullOrWhitespace(emailSubject, emailContent, pageContent))
            {
                Database.Instance.UpdateEmailContent(emailSubject, emailContent);
                Database.Instance.UpdateConfirmationPageContent(pageContent);
            }

            return(RedirectToAction(nameof(Settings)));
        }
        public static void Initialize(this AdminOverviewModel model)
        {
            var settings = Database.Instance.GetSettings();

            model.ActiveEventsCount    = Database.Instance.GetActiveEventsCount();
            model.NewestBooking        = Database.Instance.GetNewestActiveBooking();
            model.PendingBookingsCount = Database.Instance.GetPendingBookingsCount();
            model.RulesCount           = Database.Instance.GetRuleCount();
            model.TotalBookingCount    = Database.Instance.GetTotalBookingCount();
            model.UpcomingBookings     = Database.Instance.GetUpcomingBookingsFor(DateTime.Today);

            if (Database.Instance.GetEmailRecipientsCount() == 0)
            {
                model.Warnings.Add(AdminOverviewModel.Warning.NO_EMAIL_RECIPIENTS_CONFIGURED);
            }

            if (model.ActiveEventsCount == 0)
            {
                model.Warnings.Add(AdminOverviewModel.Warning.NO_EVENTS_CONFIGURED);
            }

            if (Database.Instance.GetTimesCount() == 0)
            {
                model.Warnings.Add(AdminOverviewModel.Warning.NO_TIMES_CONFIGURED);
            }

            if (!ValidationUtility.AreNotNullOrWhitespace(settings.EmailContent, settings.EmailSubject))
            {
                model.Warnings.Add(AdminOverviewModel.Warning.NO_EMAIL_CONTENT_CONFIGURED);
            }

            if (!ValidationUtility.AreNotNullOrWhitespace(settings.ConfirmationPageContent))
            {
                model.Warnings.Add(AdminOverviewModel.Warning.NO_CONFIRMATION_PAGE_CONTENT_CONFIGURED);
            }
        }