// GET: People/Details/5 public ActionResult Details(int id) { PersonFound personFound = PersonService.GetById(id); if (!personFound.Found) { return(View(nameof(Index))); } return(View(personFound.Person)); }
private static void RemoveFriend() { int Id = Int32.Parse(ReadStringFromInput("Your ID: ")); PersonFound personFound = PersonService.GetById(Id); if (!personFound.Found) { Console.WriteLine("ID does not exists."); return; } int FriendId = Int32.Parse(ReadStringFromInput("Friend ID: ")); if (FriendId == Id) { Console.WriteLine("You can not remove yourself as your friend."); return; } PersonFound friendFound = PersonService.GetById(FriendId); if (!friendFound.Found) { Console.WriteLine("ID does not exists."); return; } if (!personFound.Person.Friends.Exists(personFriend => personFriend.personId == personFound.Person.Id && personFriend.friendId == friendFound.Person.Id)) { Console.WriteLine("This person is not your friend."); return; } PersonService.RemovePersonFriend(personFound.Person.Id, friendFound.Person.Id); }