/// <summary> /// Takes in the parameters necessary to create a valid Session Model /// Converts the array contaning the position of appearances in the search to a strin g /// calls the corresponding repo to save the session to the database /// </summary> /// <returns></returns> public Session saveSession(requestBody request, string requestedUrl, int[] appearances) { string appearancesString = ""; for (int i = 0; i < appearances.Length; i++) { if (i + 1 != appearances.Length) { appearancesString += appearances[i].ToString() + ","; } else { appearancesString += appearances[i].ToString(); } } Session session = new Session() { requestTime = DateTime.Now, keyWords = request.keyWords, requestedUrl = requestedUrl, query = request.query, appearedList = appearancesString, numberOfResults = request.numOfResults }; sessionRepo.saveSession(session); return(session); }