//[Authorize] // //******************************************* Add this method to set the ViewModel "arole variable" public ActionResult IndexAdmin() { // ****************************************** this set the viewmodel admin role ( var vm = new EventViewModel(true); vm.HandleRequest(); return(View("Index", vm)); }
//[Authorize] public ActionResult Index() { var vm = new EventViewModel(); vm.HandleRequest(); return(View(vm)); }
public ActionResult IndexAdmin(EventViewModel vm) { // ****************************************** this set the viewmodel admin role ( vm.IsValid = ModelState.IsValid; // added ***************************** vm.HandleRequest(); // redirect if we need to add marketing material to the product if (vm.EventCommand.Equals("updateMaterials")) { return(RedirectToAction("IndexAdmin", "MarketingMaterial", new { id = vm.EventArgument, role = true })); } else if (vm.EventCommand.Equals("updateAttendance")) { return(RedirectToAction("IndexAdmin", "Attendee", new { id = vm.EventArgument, role = true })); } // NOTE: Must clear the model state in order to bind // the @Html helpers to the new model values if modelstate is valid if (vm.IsValid) // added ******************************* { ModelState.Clear(); } return(View("Index", vm)); }