Example #1
0
        static void Main(string[] args)
        {
            Dictionary <string, string> myDictionary = new Dictionary <string, string>();
            string CombinedEntry;

            Console.WriteLine("Enter number of entries: ");
            int numberOfEntries = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i < numberOfEntries; i++)
            {
                Console.WriteLine("Enter name space number: ");
                CombinedEntry = Console.ReadLine();
                string[] separatedWords = CombinedEntry.Split(' ');
                myDictionary.Add(separatedWords[0], separatedWords[1]);
            }

            string queryEntry;

            while ((queryEntry = Console.ReadLine()) != null)
            {
                try
                {
                    Console.WriteLine("Enter query: ");
                    queryEntry = Console.ReadLine();
                    Console.WriteLine(queryEntry + "=" + myDictionary[queryEntry]);
                }
                catch
                {
                    Console.WriteLine("Not found");
                }
            }
        }
Example #2
0
 public async Task <QOTDAnswer[]> GetIncompleteItemsAsync(CombinedEntry CE)
 {
     QOTDAnswer[] items;
     return(items = await _context.QOTDAnswers
                    .Where(x => x.QuestionID == CE.id)
                    .ToArrayAsync());
 }
Example #3
0
      public async Task <IActionResult> About(int?QuestionID)
      {
          if (QuestionID.HasValue)
          {
              var idddd            = QuestionID.GetValueOrDefault();
              List <QOTDAnswer> an = await _context.QOTDAnswers.Where(x => x.QuestionID == idddd).ToListAsync();

              Question pageQ = _context.QOTDQuestion.SingleOrDefault(x => x.id == idddd);
              List <AuthorListElement> AuthorQuery = await _context.QOTDParticipants.Select(x => new AuthorListElement {
                    FullName = x.GivenName + " " + x.FamilyLetter, id = x.id
                })
                                                     .OrderBy(x => x.FullName)
                                                     .Distinct()
                                                     .ToListAsync();

              CombinedEntry testing = new CombinedEntry()
              {
                  QuestionText = pageQ.QuestionText,
                  QuestionDate = pageQ.QuestionDate,
                  Authors      = Add(AuthorQuery, 4),
                  Answers      = an,
              };
              ViewBag.questionid = true;
              return(View(testing));
          }
          else
          {
              ViewData["Message"] = "About La Noble Assemblee";
              List <string>            mylist      = new List <string>(new string[] { "element1", "element2", "element3" });
              List <AuthorListElement> AuthorQuery = await _context.QOTDParticipants
                                                     .Select(x => new AuthorListElement {
                    FullName = x.GivenName + " " + x.FamilyLetter, id = x.id
                })
                                                     .OrderBy(x => x.FullName)
                                                     .Distinct()
                                                     .ToListAsync();

              CombinedEntry testing = new CombinedEntry()
              {
                  QuestionDate = DateTime.Today,
                  Authors      = Add(AuthorQuery, 4),
                  Answers      = new List <QOTDAnswer> {
                      new QOTDAnswer {
                          Answer = "wwwww"
                      },
                      new QOTDAnswer {
                          Answer = "wwwwwd"
                      }
                  }
              };
              ViewBag.questionid = false;
              return(View(testing));
          }
      }