Example #1
0
 public void createNotification(ConnectionNotification notification)
 {
     _context.Entry(notification.User1).State = System.Data.Entity.EntityState.Unchanged;
     _context.Entry(notification.User2).State = System.Data.Entity.EntityState.Unchanged;
     _context.Entry(notification).State       = System.Data.Entity.EntityState.Added;
     var result = _context.SaveChanges();
 }
 public static void CheckAssertsForConnectionNotification(ConnectionNotification expected, ConnectionNotification actual)
 {
     Assert.AreEqual(expected.ID, actual.ID);
     Assert.AreEqual(expected.Content, actual.Content);
     Assert.AreEqual(expected.Date, actual.Date);
     CheckAssertsForUser(expected.User1, actual.User1);
     CheckAssertsForUser(expected.User2, actual.User2);
 }
        public async Task <Connection> AcceptConnection(Connection connection)
        {
            var result = await _repo.AcceptConnection(connection);

            var notification = new ConnectionNotification {
                User1 = connection.User2, User2 = connection.User1, Date = DateTime.Now, Read = false, Content = "accepted your request for connection"
            };

            _notificationRepo.createNotification(notification);
            return(result);
        }
 public static ConnectionNotification CreateConnectionNotificationCopy(ConnectionNotification original)
 {
     return(new ConnectionNotification
     {
         ID = original.ID,
         Content = original.Content,
         Date = original.Date,
         Read = original.Read,
         User1 = CreateUserCopy(original.User1),
         User2 = CreateUserCopy(original.User2)
     });
 }
 private void HandleConnectionEvent()
 {
     log.Info("Socket connection made.");
     ConnectionNotification?.Invoke(this, ConnectionResult.SUCCESS);
 }
 private void HandleConnectionError()
 {
     log.Info("Socket could not make a connection to the remote host.");
     ConnectionNotification?.Invoke(this, ConnectionResult.FAIL);
 }