Ejemplo n.º 1
0
        public ActionResult DemoteFromAdmin(OrganizationHomeViewModel model)
        {
            ModelState.RemoveErrorsExcept("OrganizationId,DemoteFromAdminPersonId");
            if (!ModelState.IsValid)
            {
                return(View("Home", CreateHomeViewModel(model)));
            }

            try
            {
                ConfirmAdminAccess(model.OrganizationId);
                VolunteerService.DemoteVolunteerFromOrganizationAdmin(model.OrganizationId, model.DemoteFromAdminPersonId);

                return(Redirect("Home/" + model.OrganizationId));
            }
            catch (ArgumentException ex)
            {
                ModelState.AddModelError("", ex.Message);
            }

            return(View("Home", CreateHomeViewModel(model.OrganizationId)));
        }