Exemplo n.º 1
0
        public ActionResult Calculate()
        {
            ViewBag.CategoryCount          = _categoryService.Count();
            ViewBag.TitleinYazilimCategory = _titleService.Count(t => t.Id == 6);                                     //Kategorisi "Yazılım" olan başlıkların sayısı.
            ViewBag.AuthorWithALetter      = _authorService.GetAll().Where(a => a.Name.Contains('a')).ToList().Count; // İsminde a harfi bulunan yazarların sayısı
            ViewBag.CategoryHasMostTitle   = _titleService.GetCategoryDetails().GroupBy(x => x.CategoryName).
                                             Select(grp => new { CategoryName = grp.Key, Count = grp.Count() }).
                                             OrderByDescending(x => x.Count).FirstOrDefault().CategoryName; // En çok Başlığa sahip kategori sayısı
            ViewBag.DifferanceBetweenStatusTrueAndFalse =
                _categoryService.GetAll(x => x.Status == true).Count -
                _categoryService.GetAll(x => x.Status == false).Count;  //Aktif olan kategoriler ile pasif olan kategorilerin farkı



            return(View());
        }