public IActionResult Update([FromBody] UsersRegisterModel _requestPram) { try { IUserService usersServiceImpl = new UsersServiceImpl(); int result = usersServiceImpl.UpdateUser(_requestPram); return(Ok(result)); } catch (Exception ex) { return(Ok(ex)); } }
public int AddUser(UsersRegisterModel _param) { // DB検索用パラメータークラス用意 RegistUserParam registUserParam = new RegistUserParam(); registUserParam.UserId = _param.UserId; registUserParam.UserPass = _param.UserPass; registUserParam.StaffKbn = _param.StaffKbn; registUserParam.StoreCode = _param.StoreCode; // DB検索実施 IUsersRepository authenticationRepository = new UsersRepositoryImpl(); var result = authenticationRepository.AddUser(registUserParam); return(result); }
public IHttpActionResult Register(string externalId, [FromBody] UsersRegisterModel model) { try { UsersDataObject usersDO = dataAccess.GetUserByExternalID(externalId); if (usersDO == null) { return(NotFound()); } //var principal = Thread.CurrentPrincipal; ClaimsPrincipal user = Request.GetRequestContext().Principal as ClaimsPrincipal; if (!user.HasClaim(x => x.Type == ClaimTypes.Name)) { return(BadRequest("Invalid authentication, please request another access token")); } Claim username = user.Claims.Where(x => x.Type == ClaimTypes.Name).FirstOrDefault(); Proxy.BioConnectAPI.SecurityTokenDto authorizedToken = bioConnectAPIProxy.RetrieveSecurityTokenByUsername(username.Value); if (authorizedToken == null) { return(BadRequest("Invalid authentication, please request another access token")); } Proxy.BioConnectAPI.SecurityTokenDto newToken = new Proxy.BioConnectAPI.SecurityTokenDto { Password = model.Password, UserName = model.UserName, UserID = usersDO.Id, Level = model.Role, Locations = new string[] { "Default" } }; bioConnectAPIProxy.SaveSecurityToken(newToken, authorizedToken); return(Ok()); } catch (Exception ex) { return(InternalServerError(ex)); } }