Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 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();

            return View(model);
        }
Exemplo n.º 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.";
                }
                
                objectiveService.AddObjective(model.Objective);
                model.LoggedInUser = await objectiveService.GetCurrentUser();
                model.FullNavList = CreateObjectivesAdminNavList();

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

                return View(model);
            }
        }