Пример #1
0
        public async Task <Punkty6> GetPoints322(int id)
        {
            Punkty6 output = new Punkty6();
            Route   route2 = await db.Routes.FindAsync(id);

            if (route2 == null)
            {
                return(null);
            }

            Punkty6 punkty6 = new Punkty6();

            punkty6.Name        = route2.Name;
            punkty6.Description = route2.Description;
            punkty6.ImageUrl    = route2.ImageUrl;
            punkty6.UserName    = route2.UserName;
            punkty6.id          = route2.Id;
            punkty6.points      = new List <string>();
            List <Points3> points2 = new List <Points3>(db.Points3.Where(q => q.RouteId == route2.Id));

            foreach (Points3 point2 in points2)
            {
                punkty6.points.Add(point2.Name);
            }
            List <AnswerAndQuestion2> answerAndQuestion2s =
                new List <AnswerAndQuestion2>(db.AnswerAndQuestion2.Where(q => q.RouteId == route2.Id));

            punkty6.AsnwerQAndQuestion = new List <AsnwerQAndQuestion3>();

            foreach (AnswerAndQuestion2 answer in answerAndQuestion2s)
            {
                AsnwerQAndQuestion3 asnwerAnd = new AsnwerQAndQuestion3();
                asnwerAnd.Question1   = answer.Question1;
                asnwerAnd.AnswersList = new List <string>(answer.Answers);


                punkty6.AsnwerQAndQuestion.Add(asnwerAnd);
            }
            //punkty6.
            output = punkty6;

            return(output);
        }
Пример #2
0
        public async Task <List <Punkty6> > GetPoints322()
        {
            List <Route>   routes2 = new List <Route>(db.Routes);
            List <Punkty6> output  = new List <Punkty6>();

            foreach (Route route2 in routes2)
            {
                Punkty6 punkty6 = new Punkty6();
                punkty6.Name        = route2.Name;
                punkty6.Description = route2.Description;
                punkty6.ImageUrl    = route2.ImageUrl;
                punkty6.UserName    = route2.UserName;
                punkty6.id          = route2.Id;
                punkty6.points      = new List <string>();
                List <Points3> points2 = new List <Points3>(db.Points3.Where(q => q.RouteId == route2.Id));
                foreach (Points3 point2 in points2)
                {
                    punkty6.points.Add(point2.Name);
                }
                List <AnswerAndQuestion2> answerAndQuestion2s =
                    new List <AnswerAndQuestion2>(db.AnswerAndQuestion2.Where(q => q.RouteId == route2.Id));
                punkty6.AsnwerQAndQuestion = new List <AsnwerQAndQuestion3>();

                foreach (AnswerAndQuestion2 answer in answerAndQuestion2s)
                {
                    AsnwerQAndQuestion3 asnwerAnd = new AsnwerQAndQuestion3();
                    asnwerAnd.Question1   = answer.Question1;
                    asnwerAnd.AnswersList = new List <string>(answer.Answers);


                    punkty6.AsnwerQAndQuestion.Add(asnwerAnd);
                }
                //punkty6.
                output.Add(punkty6);
            }
            return(output);
        }