public GetFill listFilters()
        {
            GetFill item = new GetFill()
            {
                ListLevel    = new HashSet <string>(),
                ListType     = new HashSet <string>(),
                ListCreateBy = new HashSet <string>()
            };

            foreach (var it in context.Questions)
            {
                item.ListLevel.Add(it.Level.ToString());
                item.ListType.Add(it.Type.ToString());
                item.ListCreateBy.Add(it.CreatedBy);
            }

            return(item);
        }
コード例 #2
0
        public GetFill listFilters()
        {
            GetFill item = new GetFill()
            {
                ListLevel    = new HashSet <string>(),
                ListType     = new HashSet <string>(),
                ListCreateBy = new HashSet <string>(),
                ListCategory = new HashSet <string>()
            };

            foreach (var it in context.Questions)
            {
                item.ListLevel.Add(it.Level.ToString());
                item.ListType.Add(it.Type.ToString());
                item.ListCreateBy.Add(it.CreatedBy);
            }

            foreach (var category in context.Questions)
            {
                try
                {
                    var cateogories = context.Categorys.Where(c => c.Id == category.Category.Id).SingleOrDefault();

                    if (category.Category.Id == cateogories.Id)
                    {
                        item.ListCategory.Add(category.Category.Name);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }

            return(item);
        }