Example #1
0
        public override Node Visit(Node node)
        {
            if (node == null)
            {
                return(null);
            }

            LocalDataStoreSlot slot   = Thread.GetNamedDataSlot("TrackingVisitor");
            TrackingVisitor    parent = Thread.GetData(slot) as TrackingVisitor;

            if (parent == null)
            {
                Thread.SetData(slot, this);
                this.visitedNodes    = new ListStack <Node>();
                this.visitedContexts = new ListStack <SourceContext>();
            }
            else if (parent != this)
            {
                this.visitedNodes    = parent.visitedNodes;
                this.visitedContexts = parent.visitedContexts;
            }

            this.PushNode(node);

            node = base.Visit(node);

            this.PopNode();

            if (parent == null)
            {
                Thread.SetData(slot, null);
            }

            return(node);
        }
Example #2
0
        //
        // GET: /Comment/
        public ActionResult CommentList(Guid id, Guid qId)
        {
            var context = new StackOverflowContext();
            var m       = new CommentListCollectionModel()
            {
                Comments        = new ListStack <CommentListModel>(),
                ParentReference = id, QuestionReference = qId
            };

            IList <CommentListModel> models = new ListStack <CommentListModel>();

            var comments = context.Comments.Include(x => x.Owner);

            foreach (Comment com in comments)
            {
                if (com.ReferenceToQuestionOrAnswer == id)
                {
                    var c = new CommentListModel
                    {
                        CreationDate = com.CreationDate,
                        Description  = com.Description,
                        OwnerIf      = com.Owner.Id,
                        ReferenceToQuestionOrAnswer = com.ReferenceToQuestionOrAnswer,
                        ReferenceToQuestion         = com.QuestionReference,
                        OwnerName = com.Owner.Name
                    };
                    m.Comments.Add(c);
                }
            }
            return(PartialView(m));
        }
Example #3
0
        public static TreeNode <char> MakeExpressionTree(string expression)
        {
            ListStack <TreeNode <char> > stack = new ListStack <TreeNode <char> >();

            foreach (char character in expression)
            {
                TreeNode <char> currentNode = new TreeNode <char>();

                if (char.IsDigit(character))
                {
                    currentNode.Data = character;
                }
                else
                {
                    currentNode.RightNode = new TreeNode <char> {
                        Data = stack.Pop().Data
                    };
                    currentNode.LeftNode = new TreeNode <char> {
                        Data = stack.Pop().Data
                    };

                    currentNode.Data = character;
                }

                stack.Push(currentNode);
            }

            return(stack.Pop());
        }
 public void EmptyStackExceptionTest()
 {
     var stack = new ListStack<int>();
     stack.Push(1010101);
     stack.Pop();
     stack.Pop();
 }
Example #5
0
 public void Initialize()
 {
     list      = new ListStack();
     array     = new ArrayStack();
     calcList  = new Calculator(list);
     calcArray = new Calculator(array);
 }
Example #6
0
 public CountsQueryModel()
 {
     _tables       = new List <DropDownItem>();
     _columns      = new ListStack <DropDownItem>();
     CriteriaModel = new CriteriaModel();
     QueryCriteria = new List <CriteriaGridViewModel>();
 }
Example #7
0
        public List <GroupDto> GetGroupDtoList(List <Group> groups, int userId)
        {
            List <GroupDto> groupsDto = new ListStack <GroupDto>();

            groups.ForEach(g => groupsDto.Add(GetGroupInDto(g, userId)));
            return(groupsDto);
        }
Example #8
0
        public ActionResult RecentQuestions(Guid ownerId)
        {
            IList <QuestionListModel> models = new ListStack <QuestionListModel>();
            var context = new StackOverflowContext();
            var que = context.Questions.Include(r => r.Owner).OrderByDescending(y => y.CreationDate).ToList();
            int i, count = 0;

            for (i = 0; i < que.Count; i++)
            {
                if (count >= 5 || que.ElementAt(i).Owner.Id != ownerId)
                {
                    break;
                }
                QuestionListModel model = new QuestionListModel();
                model.Title        = que.ElementAt(i).Title;
                model.Votes        = que.ElementAt(i).Votes;
                model.CreationTime = que.ElementAt(i).CreationDate;
                model.OwnerName    = que.ElementAt(i).Owner.Name;
                model.QuestionId   = que.ElementAt(i).Id;
                model.OwnerId      = que.ElementAt(i).Owner.Id;
                model.Views        = que.ElementAt(i).NumberOfViews;
                var trimmed   = que.ElementAt(i).Description.Trim();
                var substring = trimmed.Substring(0, Math.Min(10, trimmed.Length));
                model.QuestionPreview = substring + "...";
                count++;
                models.Add(model);
            }
            return(PartialView(models));
        }
        public void ShowVertexGraphWithDepth(GraphVertex vertexStart)
        {
            Console.Write(vertexStart + "부터 탐색 : ");

            GraphVertex vertexVisit = vertexStart;

            VisitVertex(vertexVisit);

            ListStack <GraphVertex> stack = new ListStack <GraphVertex>();

            stack.Push(vertexVisit);

            while (_lists[(int)vertexVisit].ReadFirst())
            {
                bool visitFlag  = false;
                var  vertexNext = _lists[(int)vertexVisit].CurrentNode.Data;

                if (VisitVertex(vertexNext))
                {
                    stack.Push(vertexVisit);

                    vertexVisit = vertexNext;
                    visitFlag   = true;
                }
                else
                {
                    while (_lists[(int)vertexVisit].ReadNext())
                    {
                        vertexNext = _lists[(int)vertexVisit].CurrentNode.Data;

                        if (!VisitVertex(vertexNext))
                        {
                            continue;
                        }

                        stack.Push(vertexVisit);

                        vertexVisit = vertexNext;
                        visitFlag   = true;
                        break;
                    }
                }

                if (visitFlag)
                {
                    continue;
                }
                if (stack.IsEmpty())
                {
                    break;
                }

                vertexVisit = stack.Pop();
            }

            Console.WriteLine();

            InitializeVisitInformation();
        }
    public static void Main(string[] args)
    {
        IStack <int> s1 = new ArrayStack <int>( );
        IStack <int> s2 = new ListStack <int>( );

        stackOps("ArrayStack", s1);
        stackOps("ListStack", s2);
    }
        public void EmptyStackExceptionTest()
        {
            var stack = new ListStack <int>();

            stack.Push(1010101);
            stack.Pop();
            stack.Pop();
        }
Example #12
0
        private static void RemoveJsrInstructions(ConstantPool pool, BasicBlock block, DataPoint
                                                  data)
        {
            ListStack <VarType> stack = data.GetStack();
            InstructionSequence seq   = block.GetSeq();

            for (int i = 0; i < seq.Length(); i++)
            {
                Instruction instr = seq.GetInstr(i);
                VarType     var   = null;
                if (instr.opcode == ICodeConstants.opc_astore || instr.opcode == ICodeConstants.opc_pop)
                {
                    var = stack.GetByOffset(-1);
                }
                InstructionImpact.StepTypes(data, instr, pool);
                switch (instr.opcode)
                {
                case ICodeConstants.opc_jsr:
                case ICodeConstants.opc_ret:
                {
                    seq.RemoveInstruction(i);
                    i--;
                    break;
                }

                case ICodeConstants.opc_astore:
                case ICodeConstants.opc_pop:
                {
                    if (var.type == ICodeConstants.Type_Address)
                    {
                        seq.RemoveInstruction(i);
                        i--;
                    }
                    break;
                }
                }
            }
            block.mark = 1;
            for (int i = 0; i < block.GetSuccs().Count; i++)
            {
                BasicBlock suc = block.GetSuccs()[i];
                if (suc.mark != 1)
                {
                    RemoveJsrInstructions(pool, suc, data.Copy());
                }
            }
            for (int i = 0; i < block.GetSuccExceptions().Count; i++)
            {
                BasicBlock suc = block.GetSuccExceptions()[i];
                if (suc.mark != 1)
                {
                    DataPoint point = new DataPoint();
                    point.SetLocalVariables(new List <VarType>(data.GetLocalVariables()));
                    point.GetStack().Push(new VarType(ICodeConstants.Type_Object, 0, null));
                    RemoveJsrInstructions(pool, suc, point);
                }
            }
        }
Example #13
0
 private static void SafePopFromStack(ListStack<string> stack, Activity activity) 
 { 
     if (stack.Count == 0) 
         throw new InvalidOperationException("Стек пуст"); 
     var top = stack.Peek(); 
     if (string.CompareOrdinal(top, activity.Name) != 0) 
         throw new InvalidOperationException("На вершине стека другое действие: " + top); 
     stack.Pop(); 
 } 
Example #14
0
        public void ListStackPush()
        {
            var stack = new ListStack <int>();

            for (var i = 0; i < operationsCount; ++i)
            {
                stack.Push(i);
            }
        }
Example #15
0
        public void TestIsEmpty()
        {
            IStack <int> sut = new ListStack <int>();

            Assert.True(sut.IsEmpty());

            sut.Push(5);
            Assert.False(sut.IsEmpty());
        }
Example #16
0
        public ActionResult Search(SearchViewModel tempModel)
        {
            List <CarViewModel> carViewModels = new ListStack <CarViewModel>();

            //put code of search DAO

            CarDAO.GetCar(tempModel);

            return(RedirectToAction("SearchResult", new{ carViewModels }));
        }
 public void ObjectStackTest()
 {
     var stack = new ListStack<object>();
     stack.Push(1010101);
     stack.Push(-Math.PI);
     stack.Push("ya");
     Assert.AreEqual("ya", stack.Pop());
     Assert.AreEqual(-Math.PI, stack.Pop());
     Assert.AreEqual(1010101, stack.Pop());
 }
        public ActionResult Search(SearchViewModel tempModel)
        {
            List<CarViewModel> carViewModels = new ListStack<CarViewModel>();

            //put code of search DAO

            CarDAO.GetCar(tempModel);

            return RedirectToAction("SearchResult",new{carViewModels});
        }
        public void ObjectStackTest()
        {
            var stack = new ListStack <object>();

            stack.Push(1010101);
            stack.Push(-Math.PI);
            stack.Push("ya");
            Assert.AreEqual("ya", stack.Pop());
            Assert.AreEqual(-Math.PI, stack.Pop());
            Assert.AreEqual(1010101, stack.Pop());
        }
Example #20
0
        public void TestPush()
        {
            IStack <int> sut = new ListStack <int>();

            Assert.Throws <ArgumentOutOfRangeException>(() => sut.Top());
            sut.Push(3);
            Assert.Equal(3, sut.Top());
            sut.Push(4);
            sut.Push(5);
            Assert.Equal(5, sut.Top());
        }
 private void VisitTree(Statement stat)
 {
     lstack    = new ListStack <Statement>();
     ncounter  = 0;
     tset      = new HashSet <Statement>();
     dfsnummap = new Dictionary <Statement, int>();
     lowmap    = new Dictionary <Statement, int>();
     Visit(stat);
     Sharpen.Collections.AddAll(setProcessed, tset);
     setProcessed.Add(stat);
 }
Example #22
0
        private static List <Exprent> GetDimensions(int arrayDim, ListStack <Exprent> stack
                                                    )
        {
            List <Exprent> lstDims = new List <Exprent>();

            for (int i = 0; i < arrayDim; i++)
            {
                lstDims.Add(0, stack.Pop());
            }
            return(lstDims);
        }
Example #23
0
    public void CheckEmptyStack_ToArrayMethod_ShouldReturnEmptyArray()
    {
        // Arrange
        ListStack<int> stack = new ListStack<int>();

        // Act
        int[] stackArr = stack.ToArray();

        // Assert
        Assert.AreEqual(0, stackArr.Length);
    }
Example #24
0
    public void Initialize_EmptyStack_ShouldHaveZeroCount()
    {
        // Arrange
        ListStack<int> nums = new ListStack<int>();

        // Act
        int count = nums.Count;

        // Assert
        Assert.AreEqual(0, count);
    }
Example #25
0
    public void AddElementTo_EmptyStack_ShouldHaveOneCount()
    {
        // Arrange
        ListStack<int> nums = new ListStack<int>();
        nums.Push(3);

        // Act
        int count = nums.Count;

        // Assert
        Assert.AreEqual(1, count);
    }
 public void ListStackTest()
 {
     var stack = new ListStack<int>();
     stack.Push(0);
     stack.Push(10);
     stack.Push(-10);
     Assert.AreEqual(-10, stack.Pop());
     Assert.IsFalse(stack.IsEmpty());
     Assert.AreEqual(10, stack.Pop());
     Assert.AreEqual(0, stack.Pop());
     Assert.IsTrue(stack.IsEmpty());
 }
Example #27
0
 public List <Interwaly> GetAllInterwals()
 {
     using (PP_testEntities context = new PP_testEntities())
     {
         List <Interwaly> list = new ListStack <Interwaly>();
         foreach (var c in context.Interwalies)
         {
             list.Add(c);
         }
         return(list);
     }
 }
Example #28
0
    public void CheckCountWhenPopElement_ShouldSameAsBeforePush()
    {
        // Arrange
        ListStack<int> nums = new ListStack<int>();
        nums.Push(4);
        nums.Pop();

        // Act
        int count = nums.Count;

        // Assert
        Assert.AreEqual(0, count);
    }
        public void ListStackTest()
        {
            var stack = new ListStack <int>();

            stack.Push(0);
            stack.Push(10);
            stack.Push(-10);
            Assert.AreEqual(-10, stack.Pop());
            Assert.IsFalse(stack.IsEmpty());
            Assert.AreEqual(10, stack.Pop());
            Assert.AreEqual(0, stack.Pop());
            Assert.IsTrue(stack.IsEmpty());
        }
        public static void testListStack()
        {
            ListStack<int> listStack = new ListStack<int>(10);
            listStack.push(10);
            listStack.push(20);
            listStack.push(30);
            Console.WriteLine("текущий элемент стека " + listStack.peek());

            while (!listStack.isEmpty())
            {
                long value = listStack.pop();
                Console.WriteLine("извлечение элемента " + value);
            }
        }
        public List <dynamic> Get()
        {
            var customerDashboard = new ListStack <dynamic>();

            customerDashboard.Add(new
            {
                CommentPercentage = 0,
                MeanScore         = 3.55,
                NoOfComments      = 4918,
                NoOfUsers         = 3143,
                UserPercentage    = 0
            });
            return(customerDashboard);
        }
Example #32
0
    public static void Main(string[] args)
    {
        ListStack s = new ListStack();

        for (int i = 1; i <= 100; i++)
        {
            s.Push(i);
        }
        for (int i = 1; i <= 50; i++)
        {
            s.Pop();
        }
        s.print();
    }
Example #33
0
        public void TestPop()
        {
            IStack <int> sut = new ListStack <int>();

            sut.Push(1);
            sut.Push(2);
            sut.Push(3);
            sut.Push(4);
            Assert.Equal(4, sut.Pop());
            Assert.Equal(3, sut.Top());
            sut.Pop();
            sut.Pop();
            Assert.Equal(1, sut.Pop());
            Assert.True(sut.IsEmpty());
        }
Example #34
0
        public static void DisplayListStack()
        {
            ListStack <int> stack = new ListStack <int>();

            for (int i = 1; i <= 5; i++)
            {
                stack.Push(i);
            }

            while (!stack.IsEmpty())
            {
                stack.Pop();
                Console.Write(stack.CurrentData + " ");
            }
        }
Example #35
0
        public List <UnitTreeItemModel> GetChildrenEmployeeList(List <UnitTreeItemModel> childEmployees, Guid?departamentId)
        {
            List <List <UnitTreeItemModel> > BranchList = new List <List <UnitTreeItemModel> >();
            List <UnitTreeItemModel>         unitBranch;
            UnitTreeItemModel        parentUnit = new UnitTreeItemModel();
            List <UnitTreeItemModel> result     = new ListStack <UnitTreeItemModel>();

            int index = 0;

            foreach (var employee in childEmployees)
            {
                unitBranch = new List <UnitTreeItemModel>();
                parentUnit = employee;
                unitBranch.Add(parentUnit);
                while (parentUnit.ParentId != null || parentUnit.id == departamentId)
                {
                    parentUnit = (from e in db.Units
                                  where (e.Id == parentUnit.ParentId)
                                  select new UnitTreeItemModel()
                    {
                        id = e.Id,
                        Type = e.Type,
                        DataId = e.Id,
                        expanded = true,
                        Name = e.DisplayName,
                        hasChildren = true,
                        ParentId = e.ParentId,
                    }).First();
                    unitBranch.Add(parentUnit);
                }
                BranchList.Add(unitBranch);
            }
            foreach (var item in BranchList)
            {
                foreach (var unit in item)
                {
                    if (unit.id == departamentId)
                    {
                        index = item.IndexOf(unit);
                        if (item[index - 1].Type == 1)
                        {
                            result.Add(item.First());
                        }
                    }
                }
            }
            return(result);
        }
Example #36
0
        static void Main(string[] args)
        {
            var values = new int[] { 1, 2, 3, 4, 5 };

            var listStack   = new ListStack("liststack_1", values);
            var listStacker = new ListStacker(listStack);

            listStacker.Run();

            var hashSetStack   = new HashSetStack("hashsetstack_1");
            var hashSetStacker = new HashSetStacker(hashSetStack);

            hashSetStacker.Run();

            Console.WriteLine("Press enter to exit...");
            Console.ReadLine();
        }
Example #37
0
        /// <summary>
        /// Main method
        /// </summary>
        private static void Main(string[] args)
        {
            //var stack = new ArrayStack();
            var stack = new ListStack();

            Console.Write("Введите выражение в постфиксном виде: ");
            string str    = Console.ReadLine();
            int    answer = Calculator.Calculate(stack, str);

            if (answer == Int32.MinValue)
            {
                Console.WriteLine("В выражении ошибка!");
            }
            else
            {
                Console.WriteLine("Ответ: {0}", answer);
            }
        }
Example #38
0
        public static void ListStackTest(int quantity)
        {
            var stack = new ListStack <int>();

            var start = DateTime.Now;

            for (var i = 0; i < quantity; i++)
            {
                stack.Push(i);
            }
            for (var i = 0; i < quantity; i++)
            {
                stack.Pop();
            }
            var duration = DateTime.Now.Ticks - start.Ticks;

            Console.WriteLine($"\t  ListStack  \t {quantity}  \t {duration / 10000}ms");
        }
Example #39
0
        //
        // GET: /Answer/
        public ActionResult AnswerIndex(string id)
        {
            TempData["QuestionRef"] = id;
            int count = 1;
            IList <AnswerListModel> models = new ListStack <AnswerListModel>();
            var context = new StackOverflowContext();
            var ans     = context.Answers.Include(r => r.Owner).Include(r => r.QuestionReference);

            ans = ans.OrderByDescending(x => x.IsBestAnswer).ThenByDescending(y => y.Votes)
                  .ThenByDescending(z => z.CreationDate);

            foreach (Answer q in ans)
            {
                if (Guid.Parse(id) != q.QuestionReference.Id)
                {
                    continue;
                }

                var model = new AnswerListModel();

                model.AnswerCount = "Answer " + (count++);
                if (q.IsBestAnswer)
                {
                    model.BestAnswer = "Best Answer";
                }
                else
                {
                    model.BestAnswer = "";
                }
                model.CreationDate    = q.CreationDate;
                model.OwnerName       = q.Owner.Name;
                model.Votes           = q.Votes;
                model.OwnerId         = q.Owner.Id;
                model.AnswerId        = q.Id;
                model.QuestionId      = q.QuestionReference.Id;
                model.AnswerText      = q.AnswerText;
                model.QuestionOwnerId = q.QuestionReference.Owner.Id;
                model.UserHasVoted    = AnswerHasBeenVoted(model.AnswerId);
                models.Add(model);
            }

            context.SaveChanges();
            return(PartialView(models));
        }
Example #40
0
    public void CheckToArrayMethod_ForStack_ShouldReturnArrayWithReversedNumebrs()
    {
        // Arrange
        int[] arr = new int[] { 1, 2, 3, 4 };
        ListStack<int> stack = new ListStack<int>();

        // Act
        for (int i = 0; i < arr.Length; i++)
        {
            stack.Push(arr[i]);
        }

        int[] stackArr = stack.ToArray();

        // Assert
        for (int i = 0, j = arr.Length - 1; i < stackArr.Length; i++, j--)
        {
            Assert.AreEqual(arr[j], stackArr[i]);
        }
    }
Example #41
0
        private static List<string> GetClassesForDay(int numOfDay)
        {
            HtmlNode table;
            using (WebClient client = new WebClient())
            {
                HtmlDocument html = new HtmlDocument();
                html.LoadHtml(client.DownloadString("http://bikram.hu/?p=orarend"));
                table = html.DocumentNode.SelectSingleNode("//*[@id=\"ora\"]");
            }

            HtmlNodeCollection startTimes = table.SelectNodes(".//tr/td[1]");
            HtmlNodeCollection todayColumn = table.SelectNodes(".//tr/td[" + (numOfDay + 1) + "]");

            List<string> startList = new List<string>();
            startList.AddRange(startTimes.Select(n => n.InnerText));

            List<string> todayList = new List<string>();
            todayList.AddRange(todayColumn.Select(n => n.InnerText));

            List<string> result = new ListStack<string>();

            for (int i = 0; i < startList.Count; i++)
            {
                startList[i] = startList[i].Replace(".", ":");
            }

            for (int i = 0; i < todayList.Count; i++)
            {
                if (todayList[i] != "&nbsp;")
                {
                    result.Add(string.Concat(startList[i], " ", todayList[i]));
                }
            }

            return result;
        }
 public SeriesInfo()
 {
     PostsInSeries = new ListStack<PostInSeries>();
 }
Example #43
0
    public void PushPopElement_FromStackWithCapacityOne_CheckCount()
    {
        // Arrange
        ListStack<int> nums = new ListStack<int>();

        // Act and Assert
        Assert.AreEqual(0, nums.Count);

        int expectedElementSecond = 1;
        nums.Push(expectedElementSecond);
        Assert.AreEqual(1, nums.Count);

        int expectedElementFirst = 3;
        nums.Push(expectedElementFirst);
        Assert.AreEqual(2, nums.Count);

        Assert.AreEqual(expectedElementFirst, nums.Pop());
        Assert.AreEqual(1, nums.Count);

        Assert.AreEqual(expectedElementSecond, nums.Pop());
        Assert.AreEqual(0, nums.Count);
    }
Example #44
0
    public void TestAutoGrowFunctionality_With1000Elemenets()
    {
        // Arrange
        ListStack<string> words = new ListStack<string>();
        var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        var random = new Random();
        int boundary = 1000;

        // Act and Assert
        Assert.AreEqual(0, words.Count);

        for (int i = 0; i < boundary; i++)
        {
            var result = new string(
                Enumerable.Repeat(chars, 8)
                          .Select(s => s[random.Next(s.Length)])
                          .ToArray());

            words.Push(result);
            Assert.AreEqual(i + 1, words.Count);
        }

        while (words.Count > 0)
        {
            Assert.AreEqual(boundary, words.Count);
            words.Pop();
            boundary--;
        }
    }
Example #45
0
    public void PopElement_FromEmptyStack_ShouldThrowException()
    {
        // Arrange
        ListStack<int> nums = new ListStack<int>();

        // Act
        nums.Pop();

        // Assert: expected exception
    }
        public object GetWeather(double dLatitude = 47.4886, double dLongitude = -117.5786)
        {
            Debug.WriteLine(GetType().FullName + "." + MethodBase.GetCurrentMethod().Name);

            //NOTE:
            //The first thousand API calls you make every day are free, period.
            //Every API call after that costs $0.0001 each.
            //Credit us with a “Powered by Forecast” badge that links to http://forecast.io/ wherever you display data from the API.
            //https://api.forecast.io/forecast/ec8fab02bc1bf58c04e74c58bc2c3525/47.4886,-117.5786

            //https://github.com/f0xy/forecast.io-csharp  // API Key, Lat, Long, Unit
            var request = new ForecastIORequest("ec8fab02bc1bf58c04e74c58bc2c3525", (float)dLatitude, (float)dLongitude, Unit.us);
            var response = request.Get();

            var strSummary = response.daily.summary;
            var currently = response.currently;

            List<DailyForecast> tempList = new ListStack<DailyForecast>();
            tempList.AddRange(response.daily.data);
            if (!tempList.Any())
                return new HttpResponseException(HttpStatusCode.BadRequest);

            //Ember Data expects a JSon array and an id in all returns
            const int id = 1;
            var currentWeather = new { currently.summary, currently.icon, currently.temperature };
            var dailyWeather =
                tempList.AsQueryable()
                    .Select(
                        x =>
                            new
                            {
                                x.summary,
                                x.icon,
                                x.temperatureMin,
                                x.temperatureMinTime,
                                x.temperatureMax,
                                x.temperatureMaxTime
                            })
                    .ToList();

            var data = new { id, strSummary, currentWeather, dailyWeather };
            var weatherItems = new List<object>() { data }.AsEnumerable();

            return new { weatherItems };
        }