public IActionResult Post([FromBody] Register parameters) { if (parameters == null || parameters.registerParam == null || parameters.registerParam.email == null || parameters.registerParam.password == null || parameters.registerParam.username == null) { return(BadRequest(new Response("Wrong parameters", null))); } string username = parameters.registerParam.username; string email = parameters.registerParam.email; string password = parameters.registerParam.password; string error = ""; if (dbManager.CheckEmail(email)) { error = ErrorTypes.ALREADY_REG_EMAIL_ERROR.ToString(); } if (dbManager.CheckUsername(username)) { error = ErrorTypes.ALREADY_REG_NAME_ERROR.ToString(); } int id = -1; Response resp; if (error == "") { id = dbManager.RegisterUser(username, email, password); string token = TokenManager.RegisterUserToken(id, username); TokenResponse tokenResp = new TokenResponse(token, username); resp = new Response(error, tokenResp); } else { resp = new Response(error, null); } IActionResult res = Ok(resp); return(res); }