private bool validateConnection(ContactConnection connection) { bool valid = true; ValidationDic.Clear(); int existingConnections = _repo.QueryNetworkConnections().Where(c => (c.LeftId == connection.LeftId && c.RightId == connection.RightId) || (c.RightId == connection.LeftId && c.LeftId == connection.RightId)).Count(); if (existingConnections > 0) { valid = false; ValidationDic.Add("Connection", "These Companies are already connected."); } return valid; }
public bool RemoveNetworkConnection(ContactConnection connection) { try { _repo.DeleteNetworkConnection(connection); _repo.SaveChanges(); return true; } catch (Exception ex) { ValidationDic.Clear(); ValidationDic.Add("Exception", ex.Message); return false; } }