Exemple #1
0
        public ProcessOnUsernameChangeResponse ProcessOnUsernameChange(ProcessOnUsernameChangeRequest request)
        {
            File.AppendAllText(@"c:\php_requests.log", "ipConverge.onUsernameChange " + request.auth + ", " + request.new_username + "\r\n");

            EnsureValidRequest(request);

            var response = new ProcessOnUsernameChangeResponse();

            using (var db = new CSSDataContext())
            {
                var login = Login.FindLoginByUsernameOrCallsign(db, request.auth);
                if (login == null)
                {
                    login = db.Logins.FirstOrDefault(p => p.Email == request.auth);
                }

                if (login == null)
                {
                    response.completed = 1;
                    response.response  = "FAILED";
                }
                else
                {
                    login.Username     = request.new_username;
                    response.completed = 1;
                    response.response  = "SUCCESS";
                }

                db.SubmitChanges();
            }

            return(response);
        }
        public ProcessOnUsernameChangeResponse ProcessOnUsernameChange(ProcessOnUsernameChangeRequest request)
        {
            File.AppendAllText(@"c:\php_requests.log", "ipConverge.onUsernameChange " + request.auth + ", " + request.new_username + "\r\n");

            EnsureValidRequest(request);

            var response = new ProcessOnUsernameChangeResponse();

            using (var db = new CSSDataContext())
            {
                var login = Login.FindLoginByUsernameOrCallsign(db, request.auth);
                if (login == null)
                    login = db.Logins.FirstOrDefault(p => p.Email == request.auth);

                if (login == null)
                {
                    response.completed = 1;
                    response.response = "FAILED";
                }
                else
                {
                    login.Username = request.new_username;
                    response.completed = 1;
                    response.response = "SUCCESS";
                }

                db.SubmitChanges();
            }

            return response;
        }