Example #1
0
        public async Task <ActionResult> EditObjective(int id)
        {
            AddEditObjectivesViewModel model = new AddEditObjectivesViewModel();

            model.Objective    = objectiveService.GetObjectiveByID(id);
            model.LoggedInUser = await objectiveService.GetCurrentUser();

            model.FullNavList = CreateObjectivesAdminNavList();

            return(View(model));
        }
Example #2
0
        public async Task <ActionResult> AddObjectiveWithProductID(int id)
        {
            AddEditObjectivesViewModel model = new AddEditObjectivesViewModel();

            model.Objective    = new Objective();
            model.LoggedInUser = await objectiveService.GetCurrentUser();

            model.FullNavList = CreateObjectivesAdminNavList();
            model.ProductID   = id;

            return(View("AddObjective", model));
        }
Example #3
0
        public async Task <ActionResult> EditObjective(AddEditObjectivesViewModel model)
        {
            if (ModelState.IsValid)
            {
                objectiveService.EditObjective(model.Objective, model.ProductID);
            }

            model.LoggedInUser = await objectiveService.GetCurrentUser();

            model.FullNavList = CreateObjectivesAdminNavList();

            ModelState.Clear();

            return(View(model));
        }
Example #4
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));
            }
        }