public async Task <ActionResult> Connect(int companyId) { if (int.TryParse(User.GetClaimValue(Common.Constants.CompanyIdClaim), out var connectedCompanyId)) { var connection = _connectionRepository.Get(companyId, connectedCompanyId); if (connection != null) { if (connection.Status == ConnectionStatus.Rejected) { connection.Status = ConnectionStatus.Requested; await _connectionRepository.UpdateAsync(connection); _notificationService.Create(NotificationType.Email, EventType.ConnectionRequest, connection.Id); } } else { connection = await _connectionRepository.CreateAsync(companyId, connectedCompanyId); _notificationService.Create(NotificationType.Email, EventType.ConnectionRequest, connection.Id); } } return(RedirectToAction("Details", "Business", new { id = companyId })); }
public void the_user_should_have_twitter_connection() { var meleeUser = new UserModel(); meleeUser.TwitterUserId = ""; meleeUser.ScreenName = ""; meleeUser.Connections.Add(new ConnectionModel { ConnectionId = 1, ConnectionName = "Twitter", ConnectionUrl = "", ConnectionIcon = "" }); ConnectionRepository.Get(meleeUser.TwitterUserId); }