public List <Message> GetMessages(int chatId) { try { return(dbMessage.GetMessages(chatId));//returns list of messages } catch (Exception) { return(new List <Message>());//returns empty list } }
public List <Message> GetMessages(int chatId) { try { SqlConnection con = new DbConnection().GetConnection(); try { return(dbMessage.GetMessages(chatId, null, con));//returns list of messages } finally { con.Close(); } } catch (Exception) { return(new List <Message>());//returns empty list } }