Exemple #1
0
 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));
 }
Exemple #2
0
 public ActionResult Edit(int communityId)
 {
     if (CustomUser.CanEditCommunity(communityId))
     {
         Community community = CommunityShedData.GetCommunity(communityId);
         return(View(community));
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Exemple #3
0
        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));
        }