コード例 #1
0
ファイル: CommunityController.cs プロジェクト: jbvera/WOS
 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));
 }
コード例 #2
0
ファイル: CommunityController.cs プロジェクト: jbvera/WOS
 public ActionResult Edit(int communityId)
 {
     if (CustomUser.CanEditCommunity(communityId))
     {
         Community community = CommunityShedData.GetCommunity(communityId);
         return(View(community));
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
コード例 #3
0
ファイル: CommunityController.cs プロジェクト: jbvera/WOS
        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));
        }