Esempio n. 1
0
        // GET api/User
        public JSONResponse Get(string username, string password)
        {
            var response = new JSONResponse(false, null);

            try
            {
                response.responseObject = new JSONUser(_controllerInstance.Login(username, password));
            }
            catch (JJLowPrioException jjexc)
            {
                response.isException    = true;
                response.responseObject = new JSONJJLowPrioException(jjexc);
            }
            catch (Exception exc)
            {
                JJChatLoggerInstanceManager.GetInstance().Error("Fatal error occured in 'GET api/User'!", exc);
                throw exc;
            }

            return(response);
        }
Esempio n. 2
0
        // POST api/User
        public JSONResponse Post([FromBody] JSONUser jsonUser)
        {
            var response = new JSONResponse(false, null);

            try
            {
                response.responseObject = new JSONUser(_controllerInstance.Register(jsonUser?.username, jsonUser?.password));
            }
            catch (JJLowPrioException jjexc)
            {
                response.isException    = true;
                response.responseObject = new JSONJJLowPrioException(jjexc);
            }
            catch (Exception exc)
            {
                JJChatLoggerInstanceManager.GetInstance().Error("Fatal error occured in 'POST api/User'!", exc);
                throw exc;
            }

            return(response);
        }
Esempio n. 3
0
        // POST api/Chat
        public JSONResponse Post([FromBody] JSONChatMessage message)
        {
            var response = new JSONResponse(false, null);

            try
            {
                response.responseObject = _controllerInstance.SendMessage(message);
            }
            catch (JJLowPrioException jjexc)
            {
                response.isException    = true;
                response.responseObject = new JSONJJLowPrioException(jjexc);
            }
            catch (Exception exc)
            {
                JJChatLoggerInstanceManager.GetInstance().Error("Fatal error occured in 'POST api/Chat'!", exc);
                throw exc;
            }

            return(response);
        }