public async Task <IActionResult> Index() { List <HomeReporBoxModel> reportBoxs = new List <HomeReporBoxModel>(); long totalPersonalCount = await _personalService.Count(x => !x.IsDelete); reportBoxs.Add(new HomeReporBoxModel { Count = totalPersonalCount, Title = "Toplam Yabancı Sayısı", SubTitle = "Yabancı Sayısı", Icon = "icon-user", Progress = 100 }); //Okuyor Id 3 long egitimGorenCount = await _personalService.Count(x => !x.IsDelete && x.EgitimDurumu.EgitimDurumuId == 3); reportBoxs.Add(new HomeReporBoxModel { Count = egitimGorenCount, Progress = (100 * egitimGorenCount) / totalPersonalCount, Title = "Eğitim Gören Yapıncı Sayısı", SubTitle = "Eğitim Gören", Icon = "icon-user" }); reportBoxs.Add(new HomeReporBoxModel { Count = await _personalService.Count(x => !x.IsDelete), Title = "Toplam Yabancı Sayısı", SubTitle = "Yabancı Sayısı", Icon = "icon-user" }); var model = new HomeViewModel { ReporBoxModels = reportBoxs }; return(View(model)); }
public async Task <IActionResult> Index() { SessionUser sessionUser = new SessionUser { UserName = User.Identity.Name, IsAdmin = User.IsInRole(AppConst.UserRole.Admin), IsGeneral = User.IsInRole(AppConst.UserRole.General), IsHelp = User.IsInRole(AppConst.UserRole.Help), IsPrivate = User.IsInRole(AppConst.UserRole.Private), IsEducation = User.IsInRole(AppConst.UserRole.Education), IsCreate = User.IsInRole(AppConst.UserRole.Create), IsDelete = User.IsInRole(AppConst.UserRole.Delete), IsReader = User.IsInRole(AppConst.UserRole.Reader) }; if (sessionUser.IsAdmin) { sessionUser.IsGeneral = sessionUser.IsHelp = sessionUser.IsPrivate = sessionUser.IsEducation = sessionUser.IsCreate = sessionUser.IsDelete = sessionUser.IsReader = true; } else if (sessionUser.IsCreate) { sessionUser.IsGeneral = sessionUser.IsHelp = sessionUser.IsPrivate = sessionUser.IsEducation = sessionUser.IsReader = true; } HttpContextAccessor.HttpContext.Session.SetObject(AppConst.UserSessionName, sessionUser); List <HomeReporBoxModel> reportBoxs = new List <HomeReporBoxModel>(); long totalPersonalCount = await _personalService.Count(x => !x.IsDelete); reportBoxs.Add(new HomeReporBoxModel { Count = totalPersonalCount, Title = "Toplam Yabancı Sayısı", SubTitle = "Yabancı Sayısı Yüzde", Icon = "icon-user", Progress = 100 }); //Okuyor Id 3 long egitimGorenCount = await _personalService.Count(x => !x.IsDelete && x.EgitimDurumu.EgitimDurumuId == 3); reportBoxs.Add(new HomeReporBoxModel { Count = egitimGorenCount, Progress = totalPersonalCount == 0 ? 0 : (100 * egitimGorenCount) / totalPersonalCount, Title = "Eğitim Gören", SubTitle = "Eğitim Gören Yüzde", Icon = "icon-user" }); long kacakCount = await _personalService.Count(x => !x.IsDelete && (x.IkametDurumu.IkametDurumuId == 4 || x.IkametDurumu.IkametDurumuId == 5)); reportBoxs.Add(new HomeReporBoxModel { Count = kacakCount, Progress = totalPersonalCount == 0 ? 0 : (100 * kacakCount) / totalPersonalCount, Title = "Kaçak Sayısı", SubTitle = "Kaçak Sayısı Yüzde", Icon = "icon-info" }); var model = new HomeViewModel { ReporBoxModels = reportBoxs }; return(View(model)); }
public async Task <IViewComponentResult> InvokeAsync() { var count = await _personalService.Count(x => !x.IsDelete && x.IsNewItem && !x.CreatedBy.Equals(User.Identity.Name)); return(View(count)); }