public async Task <IActionResult> Post(SessionModel sessionModel) { var session = _mapper.Map <Session>(sessionModel); var createdSession = await _sessionService.AddAsync(session); return(Ok(createdSession)); }
public override async Task OnConnectedAsync() { var id = Context.GetHttpContext().Request.Headers["Id"].ToString(); var userName = Context.GetHttpContext().Request.Headers["UserName"].ToString(); SessionUser sessionUser = new SessionUser() { UserId = id, UserName = userName, StatusConnection = true, ConnectionId = Context.ConnectionId, }; var activeFriends = _friendsService.GetConnectionIdActiveFriends(id); if (activeFriends != null) { await Clients.Clients(activeFriends).NotificationFriendChangeStatus(userName, true); } await _sessionService.AddAsync(sessionUser); await base.OnConnectedAsync(); }