Ejemplo n.º 1
0
        public async Task <IEnumerable <Models.Models.Domain.Feedback> > List()
        {
            string selectStatement = string.Format("{0}{1}{2}{3}",
                                                   "SELECT ",
                                                   string.Join(",", _feedbackConverter.Fields()),
                                                   " FROM feedback",
                                                   " ORDER BY feedbackDate DESC");

            Task <List <Models.Models.Domain.Feedback> > task = new Task <List <Models.Models.Domain.Feedback> >
                                                                (
                () =>
            {
                var feedbackList = new List <Models.Models.Domain.Feedback>();
                using (IManagedDataReader reader = _sqliteConnectionManager.GetReader(selectStatement, new StatementParameters()))
                {
                    while (reader.Read())
                    {
                        feedbackList.Add(_feedbackConverter.Convert(reader));
                    }
                }

                return(feedbackList);
            });

            task.Start();

            return(await task);
        }