示例#1
0
        public async Task <ActionResult> AddSiteNotification(AddEditSiteNotificationViewModel model)
        {
            if (ModelState.IsValid)
            {
                siteService.AddSiteNotification(model.SiteNotification);
            }

            model.SiteNotification = siteService.GetSiteNotificationByID(model.SiteNotification.SiteNotificationID);
            model.LoggedInUser     = await siteService.GetCurrentUser();

            model.FullNavList = CreateHomeAdminNavList();

            return(View("EditSiteNotification", model));
        }
示例#2
0
        public async Task <ActionResult> AddObjective(AddEditObjectivesViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.ProductID != 0)
                {
                    model.Objective.AddProduct(objectiveService.GetProductByID(model.ProductID));
                }
                else if (String.IsNullOrEmpty(model.Objective.Title))
                {
                    model.Objective.Title = "Misc.";
                }

                SiteNotification notification = new SiteNotification();

                objectiveService.AddObjective(model.Objective);

                notification.Notification     = "[new][/new] [ptext]Monukai[/ptext] added an objective, [url=https://theafterparty.azurewebsites.net/objectives/objective/" + model.Objective.ObjectiveID + "][gtext]\"" + model.Objective.ObjectiveName + "\"[/gtext][/url], for the game [ptext]" + model.Objective.Title + "[/ptext]";
                notification.NotificationDate = DateTime.UtcNow;

                siteService.AddSiteNotification(notification);

                model.LoggedInUser = await objectiveService.GetCurrentUser();

                model.FullNavList = CreateObjectivesAdminNavList();

                return(View("EditObjective", model));
            }
            else
            {
                model.LoggedInUser = await objectiveService.GetCurrentUser();

                model.FullNavList = CreateObjectivesAdminNavList();

                return(View(model));
            }
        }