public async void LoadFriends(string username)
        {
            IsLoading = true;
            var           friendManager = new FriendManager();
            FriendsEntity friendEntity  =
                await
                friendManager.GetFriendsList(username, Offset, BlockedPlayer, RecentlyPlayed, PersonalDetailSharing,
                                             FriendStatus, Requesting, Requested, OnlineFilter, UserAccountEntity);

            if (friendEntity == null)
            {
                return;
            }
            if (friendEntity.FriendList == null)
            {
                HasMoreItems = false;
                return;
            }
            foreach (FriendsEntity.Friend friend in friendEntity.FriendList)
            {
                Add(friend);
            }
            if (friendEntity.FriendList.Any())
            {
                HasMoreItems = true;
                Offset       = Offset += 32;
            }
            else
            {
                HasMoreItems = false;
            }
            IsLoading = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Persiste os dados da requisição
        /// </summary>
        /// <param name="json">Json do Controller</param>
        /// <returns>Modelo WeatherForeCast</returns>
        public async Task <FriendsViewModel> Post(JObject json)
        {
            _invillaContext = new InvillaContext();

            try
            {
                var modelo = JsonConvert.DeserializeObject <FriendsViewModel>(json.ToString());
                modelo.RegistrationDate = DateTime.Now;
                var friends = new FriendsEntity
                {
                    Age              = modelo.Age,
                    FullName         = modelo.FullName,
                    RegistrationDate = modelo.RegistrationDate
                };
                _invillaContext.Add(friends);
                _invillaContext.SaveChanges();

                return(modelo);
            }
            catch (Exception ex)
            {
                return(new FriendsViewModel
                {
                });
            }
        }
Exemplo n.º 3
0
        private async Task <LoadMoreItemsResult> LoadDataAsync(uint count)
        {
            IsLoading = true;
            var           friendManager = new FriendManager();
            FriendsEntity friendEntity  =
                await
                friendManager.GetFriendsList(Username, Offset, BlockedPlayer, RecentlyPlayed, PersonalDetailSharing,
                                             FriendStatus, Requesting, Requested, OnlineFilter, UserAccountEntity);

            if (friendEntity == null)
            {
                HasMoreItems = false;
                if (Count <= 0)
                {
                    IsEmpty = true;
                }
                return(new LoadMoreItemsResult {
                    Count = count
                });
            }
            if (friendEntity.FriendList == null)
            {
                HasMoreItems = false;
                if (Count <= 0)
                {
                    IsEmpty = true;
                }
                return(new LoadMoreItemsResult {
                    Count = count
                });
            }
            foreach (FriendsEntity.Friend friend in friendEntity.FriendList)
            {
                Add(friend);
            }
            if (friendEntity.FriendList.Any())
            {
                HasMoreItems = true;
                Offset       = Offset += 32;
            }
            else
            {
                HasMoreItems = false;
                if (Count <= 0)
                {
                    IsEmpty = true;
                }
            }
            IsLoading = false;
            return(new LoadMoreItemsResult {
                Count = count
            });
        }
 public void Initialization(string strUserId)
 {
     userEtt    = new UserEntity(strUserId);
     friendsEtt = new FriendsEntity(strUserId);
     set_userInfo(strUserId);
 }