public FriendsPage() { InitializeComponent(); FriendsRepository repository = new FriendsRepository(); repository.GetFriends(); }
private async Task <Boolean> GetFriends() { this.Friends = await FriendsRepository.GetFriends(); RaiseAll(); if (this.Friends.Count > 0) { return(true); } else { return(false); } }
public IActionResult FriendsModal() { var claimsIdentity = (ClaimsIdentity)this.User.Identity; var claim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); if (claim != null) { var userId = claim.Value; var users = _context.GetFriends(userId); return(PartialView("_FriendsModal", users)); } return(RedirectToAction(nameof(Index))); }
private async void AddFriend() { //todo: friends api User.All user = this.SelectedUser; List <Friend.All> friends = await FriendsRepository.GetFriends(); if (friends != null) { var items = friends.Where(r => r.User2.ID == user.User.ID).ToList(); if (items != null && items.Count > 0) { Messenger.Default.Send <Dialog>(new Dialog() { Message = "U hebt al deze vriend.", Ok = "Ok" }); } else { Libraries.Socket socketSend = new Libraries.Socket() { From = MainViewVM.USER.ID, To = user.User.ID, Status = true }; MainViewVM.socket.Emit("friend_REQUEST:send", JsonConvert.SerializeObject(socketSend)); CloseModal(); Messenger.Default.Send <Dialog>(new Dialog() { Message = "Vrienddschapsverzoek is verzonden", Ok = "Ok" }); } } }
private async Task GetFriends() { this.Loading = true; RaisePropertyChanged("Loading"); friends_all = await FriendsRepository.GetFriends(); //Try catch errond om te zorgen dat hij niet crasht bij lege bobs. if (this.friends_all != null) { for (int i = 0; i < friends_all.Count(); i++) { try { Friend.All item = friends_all[i]; if (item.Location == null) { break; } item.VisibleShow = Visibility.Collapsed; item.ShowCommand = new RelayCommand <object>(e => ShowFriend(e)); item.RouteCommand = new RelayCommand <object>(e => mapItem_Friend(e)); item.RouteCommandText = "Toon route"; BasicGeoposition tempbasic = new BasicGeoposition(); //Locaties omzetten en in de tijdelijke posities opslaan. tempbasic.Latitude = ((Location)item.Location).Latitude; tempbasic.Longitude = ((Location)item.Location).Longitude; //Omzetten van tijdelijk punt naar echte locatie (anders krijg je die niet in de mapIconFeestLocation.Location) Geopoint temppoint = new Geopoint(tempbasic); MapIcon mapIconFeestLocation = new MapIcon(); mapIconFeestLocation.Location = temppoint; //Opgehaalde locatie //mapIconFeestLocation.Title = feest.Name; //Naam van het feestje; mapIconFeestLocation.Image = MainViewVM.Pins.UserPin; mapIconFeestLocation.Title = item.User1.ToString(); this.Map.MapElements.Add(mapIconFeestLocation);//Marker op de map zetten. } catch (Exception ex) { } } try { var newControl = new MapItemsControl(); ZoekVrienden vindrit = MainViewVM.MainFrame.Content as ZoekVrienden; newControl.ItemsSource = friends_all; newControl.ItemTemplate = (DataTemplate)vindrit.Resources["FriendsMapTemplate"] as DataTemplate; AddOrUpdateChild(newControl); } catch (Exception) { } this.Friends = friends_all.Take(10).ToList(); this.Loading = false; RaiseAll(); } }