private void labelTweetCount_MouseDown(object sender, MouseButtonEventArgs e) { UserFollow user = gridUserTop.DataContext as UserFollow; DalsaeInstence.LoadTweet(eTweetPanel.eUser, user.screen_name); }
public IDataResult <UserFollowModelDto> getUserFollowing(UserFollow userFollow) { return(new SuccessDataResult <UserFollowModelDto>(_userfollowDal.getFollow(userFollow), "Kullanıcı Takip ediyor.")); }
public IResult Update(UserFollow entity) { _userfollowDal.Update(entity); return(new SuccessResult(Messages.UserFollowUpdated)); }
public void AddFollow(UserFollow model) { Task <bool> task = repository.AddFollow(model.UserId, model.FollowUserId.Value); task.Wait(); }
public IResult Add(UserFollow entity) { _userfollowDal.Add(entity); return(new SuccessResult(Messages.Userfollowadded)); }
public void RemoveFollow(UserFollow userFollow) { _context.Follows.Remove(userFollow); }
public void RemoveFollow(UserFollow existingFollow, Guid userFollowed) { Task <bool> task = Task.Run(async() => await repository.RemoveFollower(existingFollow.UserId, userFollowed)); task.Wait(); }
public StatusServiceModel CreatePersonFollow(string suserid, string sfolloweeId, string sessionToken, int sessionId) { int userId; int followeeId; if (!int.TryParse(suserid, out userId)) throw new WebFaultException(System.Net.HttpStatusCode.NotFound); Guard.Session(sessionManager, sessionId, sessionToken, userId); if (!int.TryParse(sfolloweeId, out followeeId)) throw new WebFaultException(System.Net.HttpStatusCode.NotFound); IQueryable<User> userQuery = from u in dc.Users where u.Id == userId select u; if (userQuery.Count() != 1) throw new WebFaultException(System.Net.HttpStatusCode.NotFound); IQueryable<User> followeeQuery = from f in dc.Users where f.Id == followeeId select f; if (followeeQuery.Count() != 1) throw new WebFaultException(System.Net.HttpStatusCode.NotFound); IQueryable<UserFollow> userFollowQuery = from uf in dc.UserFollows where uf.FollowerId == userId && uf.FolloweeId == followeeId select uf; // Make sure the follow doesn't already exist. if (userFollowQuery.Count() == 0) { UserFollow userFollowNew = new UserFollow() { Follower = userQuery.First(), Followee = followeeQuery.First(), CreationDate = DateTime.UtcNow }; dc.UserFollows.InsertOnSubmit(userFollowNew); dc.SubmitChanges(); } return new StatusServiceModel() { Success = true }; }
public LacesResponse FollowUser(UserFollowRequest request) { LacesResponse response = new LacesResponse(); try { if (request.SecurityString == ConfigurationManager.AppSettings[Constants.APP_SETTING_SECURITY_TOKEN]) { LacesDataModel.User.User followedUser = new LacesDataModel.User.User(request.FollowedUserId); LacesDataModel.User.User followingUser = new LacesDataModel.User.User(request.UserId); UserFollow follow = new UserFollow(); follow.LoadByUserids(followingUser.UserId, followedUser.UserId); // Make sure follow does not already exist. if (follow.UserFollowId == 0) { follow.FollowedUserId = followedUser.UserId; follow.FollowingUserId = followingUser.UserId; follow.CreatedDate = DateTime.Now; if (follow.Add()) { followedUser.UsersFollowing++; followedUser.Update(); followingUser.UsersFollowed++; followingUser.Update(); response.Success = true; response.Message = "Operation completed successfully."; } else { response.Success = false; response.Message = "Failed to add user follow."; } } else { response.Success = true; response.Message = "User is already being followed."; } } else { response.Success = false; response.Message = "Invalid security token."; } } catch (Exception ex) { response.Success = false; if (ex.Message.Contains("find user")) { response.Message = ex.Message; } else { response.Message = "An unexpected error has occurred; please verify the format of your request."; } } return(response); }
public GetUserResponse GetUser([FromBody] GetUserRequest request) { GetUserResponse response = new GetUserResponse(); try { if (request.SecurityString == ConfigurationManager.AppSettings[Constants.APP_SETTING_SECURITY_TOKEN]) { LacesDataModel.User.User userResult = new LacesDataModel.User.User(request.UserIdToGet); response.User = new LacesAPI.Models.Response.User(); response.User.CreatedDate = userResult.CreatedDate; response.User.Description = userResult.Description; if (string.IsNullOrEmpty(userResult.DisplayName) == false) { response.User.DisplayName = userResult.DisplayName; } else { response.User.DisplayName = userResult.UserName; } response.User.Email = userResult.Email; response.User.UserName = userResult.UserName; response.User.FollowedUsers = userResult.UsersFollowed; response.User.FollowingUsers = userResult.UsersFollowing; response.User.ProfilePicture = new LacesAPI.Models.Response.ImageInfo(); Image profPic = new Image(); if (profPic.LoadAvatarByUserId(userResult.UserId)) { response.User.ProfilePicture.DateLastChanged = profPic.UpdatedDate; response.User.ProfilePicture.FileFormat = profPic.FileFormat; response.User.ProfilePicture.FileName = profPic.FileName; response.User.ProfilePicture.FileData = File.ReadAllBytes(profPic.FilePath); } else { response.User.ProfilePicture.DateLastChanged = userResult.CreatedDate; response.User.ProfilePicture.FileFormat = ConfigurationManager.AppSettings[Constants.APP_SETTING_DEFAULT_PROFILE_PIC_FORMAT]; response.User.ProfilePicture.FileName = ConfigurationManager.AppSettings[Constants.APP_SETTING_DEFAULT_PROFILE_PIC_NAME]; response.User.ProfilePicture.FileData = File.ReadAllBytes(ConfigurationManager.AppSettings[Constants.APP_SETTING_DEFAULT_PROFILE_PIC_PATH]); } response.User.Products = new List <int>(); List <LacesDataModel.Product.Product> products = LacesDataModel.Product.Product.GetProductsForUser(userResult.UserId); foreach (LacesDataModel.Product.Product prod in products) { response.User.Products.Add(prod.ProductId); } response.User.ProductCount = response.User.Products.Count(); if (userResult.UserId != request.UserId) { UserFollow isBeingFollowed = new UserFollow(); isBeingFollowed.LoadByUserids(request.UserId, userResult.UserId); if (isBeingFollowed.UserFollowId > 0) { response.IsBeingFollowed = true; } else { response.IsBeingFollowed = false; } UserFollow isFollowing = new UserFollow(); isFollowing.LoadByUserids(userResult.UserId, request.UserId); if (isFollowing.UserFollowId > 0) { response.IsFollowing = true; } else { response.IsFollowing = false; } } else { response.IsBeingFollowed = false; response.IsFollowing = false; } response.Success = true; response.Message = "User details retrieved succesfully."; } else { response.Success = false; response.Message = "Invalid security token."; } } catch (Exception ex) { response = new GetUserResponse(); response.Success = false; if (ex.Message.Contains("find user")) { response.Message = ex.Message; } else { response.Message = "An unexpected error has occurred; please verify the format of your request."; } } return(response); }
public bool Delete([FromBody] UserFollow userFollow) { UserFollowAccess userFollowAccess = new UserFollowAccess(); return(userFollowAccess.DeleteFollow(userFollow)); }
public bool Put([FromBody] UserFollow userFollow) { UserFollowAccess userFollowAccess = new UserFollowAccess(); return(userFollowAccess.AddFollow(userFollow)); }