/// <summary> /// Funkcja tworzy na mapie pin z wybranym zwierzakiem. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddAnimal(object sender, MouseButtonEventArgs e) { if (!CheckConditions()) { return; } bool newUser = true; bool isBeingUpdated = false; if (IsAnimalPinPlaced) { mainMap.Children.Remove(MyPin); IsAnimalPinPlaced = false; newUser = false; isBeingUpdated = true; } Point mousePos = e.GetPosition((IInputElement)sender); Location pinLoc = mainMap.ViewportPointToLocation(mousePos); if (usernameBox.Text.Contains(" ")) { usernameBox.Text = usernameBox.Text.ToString().Replace(@" ", @"_"); } MyPin = new Pushpin { Location = pinLoc, Tag = ((ComboBoxItem)typeBox.SelectedItem).Name.ToString(), Name = String.Format("{0}_{1}_{2}", usernameBox.Text, DateTime.Now.Millisecond, Guid.NewGuid().ToString().Replace(@"-", @"_")), Template = (ControlTemplate)FindResource("PushpinControlTemplate") }; mainMap.Children.Add(MyPin); UserInfo toAdd = new UserInfo { Nickname = MyPin.Name, AnimalType = (String)MyPin.Tag, UserLocation = MyPin.Location, LastActivityTime = System.DateTime.Now, IsNew = newUser, IsUpdated = isBeingUpdated, IsLeaving = false }; InfoOfMe = new User { UserInfo = toAdd, UserPin = MyPin }; CollectionOfUsers.Add(InfoOfMe); IsAnimalPinPlaced = true; }
public IActionResult AllUsers() { var listOfUsers = _userServices.GetAllUsers().Select(x => new ListOfAllUserViewModels { Id = x.Id, Email = x.Email, UserName = x.UserName, FirstName = x.FirstName, Lastname = x.LastName, Phonenumber = x.PhoneNumber, UCN = x.UCN }).ToList(); CollectionOfUsers allUsers = new CollectionOfUsers(); allUsers.Users.AddRange(listOfUsers); return(View(allUsers)); }