public async Task <IActionResult> ChangeShareOwner(ShareServiceModel shareServiceModel)
        {
            using (_context)
            {
                var share = await _context.ShareServiceModel.FindAsync(shareServiceModel.ShareId);

                if (share == null)
                {
                    return(NotFound());
                }

                share.TraderId = shareServiceModel.TraderId;

                await _context.SaveChangesAsync();
            }
            return(NoContent());
        }
Пример #2
0
        public async Task SendRequest(string username, string receiverId)
        {
            var user = await this.userManager.FindByNameAsync(username);

            var receiver = await this.userManager.FindByIdAsync(receiverId);

            var friend1 = new Friend {
                ApplicationUser = user, ApplicationUserFriend = receiver, FriendshipStatus = FriendshipStatus.UserPending
            };
            var friend2 = new Friend {
                ApplicationUser = receiver, ApplicationUserFriend = user, FriendshipStatus = FriendshipStatus.OtherPending
            };

            user.FriendList.Add(friend1);

            receiver.FriendList.Add(friend2);

            await db.SaveChangesAsync();
        }