public List <Message> GetMessages() { using (var conn = _dbConnection.GetConnection()) { return(_messageDataAccess.GetMessages(conn)); } }
public List <Message> GetBackMessage(int userId, string text, DateTime createdDate) { using (var conn = _dbConnection.GetConnection()) { _messageDataAccess.AddMessage(conn, userId, text, createdDate); if (text == "") { throw new Exception("no text"); } return(_messageDataAccess.GetMessages(conn)); } }
public Result <PagedList <MessageModel> > GetMessages(int userId, int pageIndex, int pageSize) { var result = new Result <PagedList <MessageModel> > { Data = messageDataAccess.GetMessages(userId, pageIndex, pageSize), Status = new Status() { Code = "1", Message = "" } }; return(result); }