public IActionResult Post([FromBody] Auth parameters) { if (parameters == null || parameters.authParam == null || parameters.authParam.email == null || parameters.authParam.password == null) { return(BadRequest(new Response("Wrong parameters", null))); } string error = ""; string email = parameters.authParam.email; string password = parameters.authParam.password; TokenResponse tr = dbManager.CheckUser(email, password); int id = Int32.Parse(tr.token); string username = tr.nickname; if (id == -1) { error += ErrorTypes.AUTH_ERROR.ToString(); } Response resp; if (error == "") { string token = ""; if (!TokenManager.CheckUser(Hash.HashId(id))) { token = TokenManager.RegisterUserToken(id, username); } else { token = Hash.HashId(id); } TokenResponse tokenResp = new TokenResponse(token, username); resp = new Response(error, tokenResp); } else { resp = new Response(error, null); } IActionResult res = Ok(resp); return(res); }