public ActionResult Filter(FilterViewModel model)
 {
     model.Contacts = new ContactBUS().GetContacts().Where(c => c.LuckyNumber == model.SelectedLuckyNumber || (model.SelectedLuckyNumber == 0 && ! c.LuckyNumber.HasValue)).ToList();
     model.LuckyNumberMap = new ContactBUS().GetContacts().Where(c=>c.LuckyNumber.HasValue).GroupBy(c => c.LuckyNumber).ToDictionary(gr => gr.Key.Value, gr => gr.Count());
     
     if(new ContactBUS().Where(c=>!c.LuckyNumber.HasValue).Any())
     {
         model.LuckyNumberMap.Add(0, model.Contacts.Where(c => !c.LuckyNumber.HasValue).Count());
     }
     
     return View(model);
 }
        public ActionResult Filter(FilterViewModel model)
        {
            var logic = new ContactBUS();

            var groupings =  logic.Contacts.Select(c => c.LuckyNumber.HasValue ? c.LuckyNumber.Value : 0 ).GroupBy(item => item);

            model.LuckyNumberMap = groupings.ToDictionary(gr => gr.Key, gr => gr.Count());

            var results = new ContactBUS().Contacts.Where(c => c.LuckyNumber == model.SelectedLuckyNumber || (model.SelectedLuckyNumber == 0 && !c.LuckyNumber.HasValue));
            
            model.Contacts = results.ToList();


            return View(model);
        }
        public ActionResult Filter(FilterViewModel model)
        {
            var logic = new ContactBUS();

            var groupings = logic.Contacts.Select(
                c => c.LuckyNumber.HasValue ? c.LuckyNumber.Value : 0).GroupBy(item => item);

            model.LuckyNumberMap = groupings.ToDictionary(gr => gr.Key, gr => gr.Count());

            var results =

            model.Contacts = new ContactBUS().Contacts.Where(c => c.LuckyNumber == model.SelectedLuckyNumber).ToList();

            //model.LuckyNumberMap = new ContactBUS().GetContacts().Where(c=>c.LuckyNumber.HasValue).GroupBy(c => c.LuckyNumber).ToDictionary(gr => gr.Key.Value, gr => gr.Count());

            //if (new ContactBUS().GetContacts().Where(c => !c.LuckyNumber.HasValue).Any())
            //    model.LuckyNumberMap.Add(0, new ContactBUS().GetContacts().Where(c => !c.LuckyNumber.HasValue).Count());

            return View(model);
        }