Beispiel #1
0
        public async Task <IActionResult> GetDuplicates(string numbers)
        {
            var input  = numbers.Split(",").ToList();
            var output = input.GroupBy(x => x)
                         .Where(g => g.Count() > 1)
                         .Select(g => g.Key)
                         .OrderBy(o => true);

            var result = new NPlusOneViewModel()
            {
                InputValues  = String.Join(",", input),
                OutputValues = String.Join(",", output)
            };

            return(Json(result));
        }
Beispiel #2
0
        public async Task <IActionResult> Index()
        {
            var input  = RandomList(10, 10).ToList();
            var output = input.GroupBy(x => x)
                         .Where(g => g.Count() > 1)
                         .Select(g => g.Key)
                         .OrderBy(o => true);

            var result = new NPlusOneViewModel()
            {
                InputValues  = String.Join(",", input),
                OutputValues = String.Join(",", output)
            };

            return(View(result));
        }