public ActionResult ByFollow(string id = "") { OldHouseUser user = null; if (id.Equals("")) { user = AppUser; } else { user = MyService.MyUserManager.FindByIdAsync(new Guid(id)).Result; } List <OldHouseUser> follows = new List <OldHouseUser>(); foreach (var one in MyService.MyUserManager.UserRepository.FindAll()) { if (MyService.AmIFollowing(user.Id, one.Id)) { follows.Add(one); } } IEnumerable <UserInformationDto> users = Mapper.Map <IEnumerable <UserInformationDto> >(follows); ViewBag.Title = user.NickName + "的粉丝"; ViewBag.Type = "粉丝"; return(View("Follow", users)); }
public bool AmIFollowing(Guid targetUserId) { if (AppUser != null) { var followerUserId = AppUser.Id; return(MyService.AmIFollowing(targetUserId, followerUserId)); } return(false); }
public ActionResult GetView(Guid id) { var lrfDto = new LrfDto { Id = id }; if (AppUser != null) { lrfDto.DidILrf = MyService.AmIFollowing(id, AppUser.Id); } return(PartialView("_PartialFollow", lrfDto)); }