public override Task OnConnectedAsync() { try { var userId = Convert.ToInt32(Context.GetHttpContext().Request.Query["userid"]); string token = Context.GetHttpContext().Request.Query["token"]; var user = userContext.GetProfile(userId).Result; if (user == null) { user = userContext.CreateUser(token).Result; } connectionContext.AddUser(user, Context.ConnectionId); /*var rooms = hubContext.Groups.GetGroupsByUserId(user.UserId).Result; * foreach (var item in rooms) * { * Groups.AddToGroupAsync(Context.ConnectionId, item.GroupName).Wait(); * }*/ OnUserChangeOnlineStatus(user.UserId, true); } catch (Exception ex) { SendError(Context.ConnectionId, ex.Message); } return(base.OnConnectedAsync()); }
public ActionResult Register([FromBody] User user) { string message = _userContext.CreateUser(user); if (!message.Equals("User was created")) { return(BadRequest(new { error = message })); } return(Ok(new { message })); }
public bool CreateUser(string name, string surName, string email, string region, string phonenumber, string adres, int gender, int userType, DateTime dob, string password) { return(_userContext.CreateUser(name, surName, email, region, phonenumber, adres, gender, userType, dob, password)); }
public void CreateUser(User user) { userContext.CreateUser(user); }
public void CreateUser(UserModel userModel) { userModel.Password = EncryptionLogic.EncryptPassword(userModel.Password); _iUserContext.CreateUser(ToUserDTO(userModel)); }