public ActionResult Edit(Community community) { if (ModelState.IsValid && CustomUser.CanEditCommunity(community.Id)) { CommunityShedData.UpdateCommunity(community); return(RedirectToAction("Details", "Community", routeValues: new { communityId = community.Id })); } return(View(community)); }
public ActionResult Edit(int communityId) { if (CustomUser.CanEditCommunity(communityId)) { Community community = CommunityShedData.GetCommunity(communityId); return(View(community)); } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult Details(int communityId) { // Querying the database for each property can get expensive. CommunityDetailsViewModel viewModel = new CommunityDetailsViewModel { Community = CommunityShedData.GetCommunity(communityId), PersonRoles = CommunityShedData.GetCommunityPersonRoles(communityId), Members = CommunityShedData.GetCommunityMembers(communityId), CanEdit = CustomUser.CanEditCommunity(communityId), CanEditMembers = CustomUser.IsInRole("Enforcer", communityId) }; return(View(viewModel)); }