public string UserGroupIsEmpty(string userGroupId) { using (RRDLEntities db = new RRDLEntities()) { UserGroupService ugs = new UserGroupService(db); UserGroup ug = ugs.FindById(Int32.Parse(userGroupId)); int count = ug.Users.Count; if (count == 0) { return "true"; } else { return "false"; } } }
/// <summary> /// 传入组id,返回小组信息 ZHAOs 2014年5月23日12:08:56 /// </summary> /// <param name="groupId"></param> /// <returns></returns> public ActionResult GetGroupByGroupId(int groupId) { RRDLEntities re = new RRDLEntities(); UserGroupService ugs = new UserGroupService(re); re.Configuration.ProxyCreationEnabled = false; UserGroup ug = ugs.FindById(groupId); return Json(ug); }
public string GetUserById(string userId) { using (RRDLEntities db = new RRDLEntities()) { UserService us = new UserService(); User user = us.FindById(userId); UserViewModel uvm = new UserViewModel(); uvm.NickName = user.NickName; uvm.RealName = user.RealName; uvm.RegisterName = user.RegisterName; uvm.Category = getAuthorityCategory(user.AuthorityCategory); int ugid = (int)user.ContentGroupId; UserGroupService ugs = new UserGroupService(); UserGroup ug = ugs.FindById(ugid); uvm.UserGroup = ug.Title; uvm.CreateTime = user.Createtime.ToString(); int approvedcount = 0; int allcount = 0; AriticleService ariticleService = new AriticleService(); Expression<Func<Ariticle, bool>> condition = a => a.Approve.ApproveStatus == EnumAriticleApproveStatus.Approved && a.UserId == user.Id; approvedcount = ariticleService.GetAriticleCount(condition); condition = a => a.UserId == user.Id; allcount = ariticleService.GetAriticleCount(condition); uvm.approvedArticleCount = approvedcount; uvm.allArticleCount = allcount; string result = JsonConvert.SerializeObject(uvm); return result; } }