Пример #1
0
        public List <CommentJson> GetComments(string product, int limit)
        {
            // Fetching comments from database
            if (limit < 1)
            {
                limit = 1;
            }
            Task <List <CommentDB> > task = tableQueries.GetComments(product, limit);

            task.Wait();
            List <CommentDB> dbLinks = task.Result;

            if (dbLinks.Count == 0)
            {
                throw new WebFaultException <string>("Product doesn't exist!", HttpStatusCode.NotFound);
            }
            return(dbLinks.ConvertAll(le => new CommentJson(le)));
        }