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)); }
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)); }