//Register public IResult Register(ForRegisterDTO forRegisterDTO, string password) { if (!userMailExist(forRegisterDTO.Email).success) { if (userUserNameExist(forRegisterDTO.UserName).success) { return(new ErrorResult(Message: "Kullanıcı Adı tekrarlı")); } } else { return(new ErrorResult(Message: "Mail tekrarlı")); } byte[] passwordHash, passwordSalt; HashingHelper.CreateHash(forRegisterDTO.Password, out passwordHash, out passwordSalt); var user = new Users { EmailAdress = forRegisterDTO.Email, UserName = forRegisterDTO.UserName, FirstName = forRegisterDTO.FirstName, LastName = forRegisterDTO.LastName, Status = true, UserPasswordHash = passwordHash, UserPasswordSalt = passwordSalt }; Users users = usersManager.Add(user).data; userOperationClaimManager.AddForRegister(users.Id); return(new SuccessResult(Message: ResultMessages.Registered + "for UserName= " + user.UserName)); }
/// <summary> /// Adds user node to the graph db. /// </summary> /// <param name="data"></param> /// <returns></returns> public async Task <IHttpActionResult> AddUser([FromBody] JObject data) { try { string token = data["token"].ToObject <string>(); string email = data["email"].ToObject <string>(); string name = data["name"].ToObject <string>(); VerifyUserData(token, email, name); await _usersManager.Add(token, email, name); return(Ok()); } catch (Exception) { throw; } }
/// <summary> /// Adds user to the Db. /// </summary> /// <param name="data"></param> /// <returns></returns> public async Task <IHttpActionResult> PostUser([FromBody] JObject data) { try { UserModel user = data["user"].ToObject <UserModel>(); string token = data["token"].ToObject <string>(); await _usersManager.Add(user, token); return(Ok()); } catch (AuthenticationException) { return(BadRequest("Authentication was not approved")); } catch (Exception) { return(InternalServerError()); } }