public RESTRequestStatus Put(string appkey, string accounttype, string accountname, string password, string newpassword, string sessionid) { RESTRequestStatus response = new RESTRequestStatus(RESTRequestStatusCode.failed); if (Security.Security.ValidRequest(appkey) == false) { response.statuscode = RESTRequestStatusCode.invalidappKey; response.status = RESTRequestStatusCode.invalidappKey.ToString( ); return(response); } if (DataLayer.Connect( ) == false) { response.statuscode = RESTRequestStatusCode.databaseerror; response.status = RESTRequestStatusCode.databaseerror.ToString( ); DataLayer.CloseConnection( ); return(response); } bool account_exists = DataLayer.AccountExists(accountname); string fullpath = Request.Path; string op = fullpath.Substring("/fluid/authentication/".Length, fullpath.Length - "/fluid/authentication/".Length); switch (op) { case Constants.signup: if (!account_exists) { DataLayer.CreateAccount(response, accounttype, accountname, password, Request.HttpContext.Connection.RemoteIpAddress.ToString( )); } else { response.response = RESTRequestStatusCode.accountexists.ToString(); } break; case Constants.login: if (account_exists) { response = DataLayer.Login(accountname, password, Request.HttpContext.Connection.RemoteIpAddress.ToString()); } break; case Constants.forgot: if (account_exists) { response = ForgotPassword(accountname); } break; case Constants.changepassword: if (account_exists) { response = ChangePassword(accountname, password, newpassword, sessionid); } break; case Constants.newsession: if (account_exists) { Int64 session_id = 0; if ((DataLayer.CreateSession(accountname, Request.HttpContext.Connection.RemoteIpAddress.ToString( ), out session_id))) { response.statuscode = RESTRequestStatusCode.success; response.status = Constants.statusSuccess; response.sessionid = session_id.ToString(); response.response = accountname; } } break; default: response.statuscode = RESTRequestStatusCode.invalidrequest; response.status = Constants.unknownRestOperation; break; } DataLayer.CloseConnection( ); return(response); }