public string messageError(HttpStatusCode error_code) { errorResponse objError = new errorResponse(); int idMessage = Convert.ToInt32(error_code); string message = ""; switch (idMessage) { case 400: message = errorResponse.error400; break; case 401: message = errorResponse.error401; break; case 404: message = errorResponse.error404; break; case 500: message = errorResponse.error500; break; default: message = "Fault occurred"; break; } return(message); }
public errorResponse responseError(HttpStatusCode error_code) { errorResponse objError = new errorResponse(); objError.error_msg = messageError(error_code); objError.error_code = error_code; objError.success = false; return(objError); }