Beispiel #1
0
        public IActionResult Post([FromBody] USearch _data)
        {
            var userId = _manager.GetUserId(User);

            _data.CurrentUser = userId;

            var holder = _service.GetTableData(_data);


            var friends = _fService.GetAllFriendsByUser(userId);

            var rData = new List <FriendCheckReturnVM>();

            foreach (var user in holder)
            {
                var a = new FriendCheckReturnVM {
                    User = user, IsFriend = false
                };
                foreach (var friend in friends)
                {
                    if (user.Id == friend.Id)
                    {
                        a.IsFriend = true;
                    }
                }
                rData.Add(a);
            }

            var value = new { data = rData };

            return(Ok(value));
        }