Пример #1
0
        public IActionResult LogIn()
        {
            StreamReader bodyStream = new StreamReader(HttpContext.Request.Body);
            string       body       = bodyStream.ReadToEndAsync().Result;

            if (UserDatabaseAccess.LogIn(_context, NetworkAPI.User.DeSerializeJson(body)))
            {
                VolatileLogs.Add("LogIn: " + body);
                return(StatusCode(200));
            }
            else
            {
                return(StatusCode(401));
            }
        }
Пример #2
0
        public IActionResult Create()
        {
            StreamReader bodyStream = new StreamReader(HttpContext.Request.Body);
            string       body       = bodyStream.ReadToEndAsync().Result;

            JsonMirrors.User.NameAndPassword nameAndPassword = NetworkAPI.User.DeSerializeJson(body);

            if (UserDatabaseAccess.CreateUser(_context, nameAndPassword.UserName, nameAndPassword.UserPassword))
            {
                VolatileLogs.Add("Create: " + body);
                return(StatusCode(201));
            }
            else
            {
                return(StatusCode(401));
            }
        }
Пример #3
0
 public IActionResult CheckConnection()
 {
     VolatileLogs.Add("CheckConnection");
     return(StatusCode(200));
 }