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)); }
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)); }
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)); }
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)); } }