Пример #1
0
        public async Task <IActionResult> EditFriend(int id, [FromBody] EditFriend data)
        {
            var friend = await _context.Friends.FirstOrDefaultAsync(x => x.Id == id);

            if (friend != null)
            {
                friend.CharacterId = data.CharacterId;
                friend.FriendId    = data.FriendId;
                await _context.SaveChangesAsync();

                return(Ok(friend.Id));
            }

            return(NotFound());
        }
Пример #2
0
        public static string createRemoveFriendRequest(string friendIdent)
        {
            EditFriend temp = new EditFriend();

            temp.id       = Globals.user.id;
            temp.friendID = friendIdent;

            var jsonString = JsonConvert.SerializeObject(temp,
                                                         Formatting.None,
                                                         new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore
            });

            return(jsonString);
        }