/// <summary> /// Returns results of type string from the database by user input in the parameter /// Also checks if the user is active /// Then returns out bool if user is inactive, also returns out string errorMsg /// </summary> /// <param name="userInput"></param> /// <param name="userId"></param> /// <param name="userIsInactive"></param> /// <param name="errorMsgOut"></param> /// <returns>String of results from the database</returns> internal string GetBooksByCategoryId(int userInput, int userId, out bool userIsInactive, out string errorMsgOut) { userIsInactive = false; errorMsgOut = ""; if (!IsSessionActive(userId, out string errorMsgIn)) { userIsInactive = true; errorMsgOut = errorMsgIn; return(""); } else { string results = "ID TITLE AUTHOR\n"; var list = webAPI.GetCategory(userInput); if (list != null) { foreach (Book b in list) { results += b.Id + ". " + b.Title + " " + b.Author + "\n"; } return(results); } else { errorMsgOut = "Error loading books by category id"; Debug.WriteLine("Getcategory list by id was null"); return(""); } } }