Example #1
0
        public ActionResult UpdateRelation(MemberListViewModel memberListViewModel)
        {
            var jsonResult = new JsonResult();
            try
            {
                var userProjectRoleRelation=new UserProjectRoleRelation
                    {
                        UserId = memberListViewModel.UserId,
                        ProjectId = memberListViewModel.ProjectId,
                        RoleId = memberListViewModel.RoleId
                    };
                _userProjectRoleRelationLogic.Update(userProjectRoleRelation);
                jsonResult.Data = new { IsSuccess = true };

            }
            catch (Exception)
            {
                jsonResult.Data = new {IsSuccess = false};
            }
            return jsonResult;
        }
Example #2
0
 public ActionResult MemberList(long projectId)
 {
     var currentUserId = _cookieHelper.GetUserId(Request);
     var currentUserRoleId = _userProjectRoleRelationLogic.GetByUserIdAndProjectId(currentUserId, projectId).RoleId;
     var userProjectRoleRelation = _userProjectRoleRelationLogic.GetByProjectId(projectId);
     var memberViewModels=new List<MemberViewModel>();
     userProjectRoleRelation.ForEach(uprr =>
         {
             var user = _userLogic.Get(uprr.UserId);
             var role = _roleLogic.Get(uprr.RoleId);
             var webPath =UserConfig.UserImageUrl;
             var memberViewModel = new MemberViewModel
                 {
                     UserId = user.UserId,
                     ImageUrl = webPath + user.UserId + ".jpg",
                     UserName = user.UserName,
                     Introduction = user.Introduction,
                     RoleId = role.RoleId,
                     RoleName = role.RoleName
                 };
             memberViewModels.Add(memberViewModel);
         });
     var memberListViewModel=new MemberListViewModel()
         {
             ProjectId = projectId,
             CurrentUserRoleId = currentUserRoleId,
             MemberViewModels = memberViewModels
         };
     return PartialView(memberListViewModel);
 }