public void DeleteFriend(int friendId)
 {
     var context = new Entities();
     var friendToDelete = context.Friends.FirstOrDefault(f => f.Id == friendId);
     context.Friends.Remove(friendToDelete);
     context.SaveChanges();
 }
Esempio n. 2
0
        public void AddFriend(Guid currentUserId, string currentUserEmail, string currentUserName, string friendEmail)
        {
            // TODO: Move this code to DAL
            var context = new Entities();
            var newFriend = context.Friends.Create();
            newFriend.UserId = currentUserId;
            newFriend.EmailAddress = friendEmail;
            context.Friends.Add(newFriend);
            context.SaveChanges();

            var notificationService = new NotificationService();
            notificationService.SendNotification(currentUserEmail, currentUserName, friendEmail, context);
        }