public async Task <Connection> CreateConnection(Connection connection) { var result = await _repo.CreateConnection(connection); var notification = new ConnectionNotification { User1 = connection.User1, User2 = connection.User2, Date = DateTime.Now, Read = false, Content = "send you request for connection" }; _notificationRepo.createNotification(notification); return(result); }
public ActionResult <Connection> CreateConnection(ConnectionDto connectionCreateDto) { if (connectionCreateDto == null) { throw new ArgumentException(nameof(connectionCreateDto)); } _connectionsRepository.CreateConnection(_mapper.Map <Connection>(connectionCreateDto)); _connectionsRepository.SaveChanges(); return(Created("", connectionCreateDto)); }