public static void UserSystemUpdate()
 {
     Console.WriteLine("----------------UserSystemUpdate----------------");
     new Thread(() => FriendList.GetPage().Update()).Start();
     new Thread(() => FriendRequest.GetPage().Update()).Start();
     new Thread(() => Profile.getPage().UpdateUser()).Start();
     new Thread(() => FriendProfile.getPage().UpdateUser()).Start();
     new Thread(() => Chat.GetPage().Update()).Start();
 }
 public FriendProfile Update(FriendProfile friend)
 {
     using (var _ctx = new DatingContext())
     {
         _ctx.Entry <FriendProfile>(friend).State = System.Data.Entity.EntityState.Modified;
         _ctx.SaveChanges();
         return(friend);
     }
 }
示例#3
0
 protected void repAccounts_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         FriendProfile pd = e.Item.FindControl("pdProfileDisplay") as FriendProfile;
         pd.LoadDisplay((Account)e.Item.DataItem);
         if (_webContext.CurrentUser == null)
         {
             pd.ShowFriendRequestButton = false;
         }
     }
 }
示例#4
0
 //Update friendProfile
 public FriendProfile Update(FriendProfile friendProfile)
 {
     try
     {
         return(_friendRepository.Update(friendProfile));
     }
     catch (Exception e)
     {
         //Log Error
         throw new Exception("An error occurred while trying to update the user's friend.");
     }
 }
        public static async Task PostSystemUpdate()
        {
            Console.WriteLine("----------------PostSystemUpdate----------------");
            await Moment.GetPage().Update();

            await Profile.getPage().UpdatePost();

            await FriendProfile.getPage().UpdatePost();

            //new Thread(async ()=>await Moment.GetPage().Update()).Start();
            //new Thread(async ()=>await Profile.getPage().Update()).Start();
            //new Thread(async ()=>await FriendProfile.getPage().Update()).Start();
        }
 public FriendProfile Add(FriendProfile friend)
 {
     using (var _ctx = new DatingContext())
     {
         var foundFriend = _ctx.Set <FriendProfile>().Any(x => x.FriendProfileId == friend.FriendProfileId && x.ProfileId == friend.ProfileId);
         if (!foundFriend)
         {
             _ctx.Entry <FriendProfile>(friend).State = System.Data.Entity.EntityState.Added;
             _ctx.SaveChanges();
         }
         return(friend);
     }
 }
示例#7
0
        public async Task <ActionResult <FriendProfile> > Get(string id)
        {
            UserModel userModel = await userManager.GetUserAsync(HttpContext.User);

            if (!userModel.HasFriend(id))
            {
                return(Status403Forbidden());
            }

            UserModel friend = await userManager.FindByIdAsync(id);

            FriendProfile friendProfile = new FriendProfile(friend);

            return(friendProfile);
        }
示例#8
0
        public FriendProfile[] AllFriends(int start = 0, int limit = 20, FriendsFilter filter = FriendsFilter.All)
        {
            var friends = _getFriends(start, limit, filter);

            if (friends == null)
            {
                return(new FriendProfile[0]);
            }
            FriendProfile[] prof = new FriendProfile[limit];
            int             x    = 0;

            foreach (var item in friends["profiles"])
            {
                prof[x++] = new FriendProfile
                {
                    OnlineId = item["onlineId"]
                };
            }
            return(prof);
        }