public IActionResult Index() { ViewBag.Home = "Home"; if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Girish", "Hesab")); } if (!User.IsInRole("Admin")) { return(RedirectToAction("Girish", "Hesab")); } AdminHomeViewModel adminHomeViewModel = new AdminHomeViewModel { NumberOfCustomUsers = _userManager.Users.Count(), NumberOfMessages = _context.Messages.Count(), NumberOfAnnouncements = _context.Announcements.Count(), NumberOfPendingAnnouncements = _context.Announcements.Where(announcement => announcement.IsActive == false && announcement.IsDeleted == false && announcement.IsBan == false).Count(), NumberOfActiveAnnouncements = _context.Announcements.Where(announcement => announcement.IsActive == true).Count(), NumberOfDeletedAnnouncements = _context.Announcements.Where(announcement => announcement.IsDeleted == true).Count(), NumberOfBanAnnouncements = _context.Announcements.Where(announcement => announcement.IsBan == true).Count() }; return(View(adminHomeViewModel)); }
public ActionResult LinkAllUsersInCourseToAnother(AdminHomeViewModel Model) { if (!ModelState.IsValid) { return(View(Model)); } for (var i = 0; i < Model.Courses.Count(); i++) { if (Model.Courses[i].IsSelected) { for (var k = 0; k < Model.Users.Count(); k++) { if (Model.Users[k].IsSelected) { var NewLink = new UserViewModel() { UserName = Model.Users[k].UserName, CourseId = Model.Courses[i].ID, }; AS.LinkUserWithCourse(NewLink); } } } } return(RedirectToAction("AllCourses")); }
/// <summary> /// Returns all userrs and courses from database /// </summary> public AdminHomeViewModel GetAllUsersAndCourses() { var AllCourses = _db.Course .Select(x => new CourseViewModel { Name = x.Name, ID = x.ID }) .ToList(); var AllUsers = _db.Users .AsEnumerable() .Select(x => new UserViewModel { UserName = x.UserName, Role = Ident.GetUserRole(x.Id), ID = x.Id }).ToList(); var ViewModel = new AdminHomeViewModel { Users = AllUsers, Courses = AllCourses, }; return(ViewModel); }
public ActionResult Home() { var model = new AdminHomeViewModel { VendorPackages = db.VendorPlans.ToList() }; return(View(model)); }
public async Task <IActionResult> Index() { var home = new AdminHomeViewModel { Articles = this.blogArticleService.AllArticles <AdminArticlesViewModel>(), Courses = await this.courseInstancesService.AllCourseInstancesAsync <AdminCoursesViewModel>() }; return(this.View(home)); }
public ActionResult AllUsers(AdminHomeViewModel model, int?page) { page = page == null ? 0 : page - 1; var users = this.userService.All(model.IsUserDeleted); ViewBag.TotalPages = this.TotalPages(users.Count()); users.RemoveRange(0, (int)page * NoleggioConstants.PagingSize); return(View("Users", users.Take(NoleggioConstants.PagingSize).ToList())); }
public IActionResult Index() { var model = new AdminHomeViewModel() { AuthorsCount = _userData.GetAuthorsCount(), CategoriesCount = _courseData.GetCategoryCount(), CoursesCount = _courseData.GetCourseCount(), EventCount = _eventData.EventsCount(), NewsCount = _newsData.NewsCount(), UserCount = _userData.GetUserCount(), }; return(View(model)); }
public ActionResult Index() { AdminHomeViewModel model = new AdminHomeViewModel(); using (ApplicationDbContext _context = new ApplicationDbContext()) { model.TotalCategories = _context.Categories.ToList().Count(); model.TotalCompanies = _context.Companieses.ToList().Count(); model.TotalWebSubscribe = _context.Subscribes.ToList().Count(); model.TotalContactsUSer = _context.ContactUse.Where(x => x.IsRead == false).ToList().Count(); model.TotalProducts = _context.Products.ToList().Count(); model.TotalCountAllProductComments = _context.ProductComments.ToList().Count(); } return(View(model)); }
public async Task <IActionResult> Index() { TempData["Active"] = TempDataInfo.Home; var user = await GirisEdenIstifadeci(); var model = new AdminHomeViewModel() { BildirimSayi = _bildirimService.OxunmamusBildirimSayi(user.Id), TamamlanmisIssayi = _jobService.TamamlanmisIsSayi(), TeyinEdilmemisIsSayi = _jobService.TeyinEdilmemisJobSayi(), UmumiReportSayi = _reportService.ReportSayi() }; return(View(model)); }
public ActionResult Index() { if (User.IsInRole("CanManageWebsite")) { AdminHomeViewModel model = new AdminHomeViewModel() { Students = _context.Students.ToList(), StudentsCanPickCourses = _context.StudentsCanPickCourses, Outlines = _context.Outlines.Include("Courses").ToList(), Classes = _context.Classes.ToList() }; return(View("AdminHome", model)); } return(View("StudentHome")); }
/// <summary> /// Returns all users from database /// </summary> public AdminHomeViewModel GetAllUserCourses(string UserName) { var OverviewUserinCourse = (from Application in _db.Course join C in _db.UserCourse on Application.ID equals C.CourseID where C.UserName == UserName select new CourseViewModel() { Name = Application.Name, ID = Application.ID }).ToList(); var ViewModel = new AdminHomeViewModel() { Courses = OverviewUserinCourse }; return(ViewModel); }
public IActionResult Index() { var vm = new AdminHomeViewModel(); var openOrders = _context.Orders.Where(o => o.IsClosed == false); var notpayedOrders = _context.Orders.Where(o => o.IsClosed == false && o.IsPayed == false); var sendOrders = _context.Orders.Where(o => o.IsClosed == false && o.IsSend == true); var closedOrders = _context.Orders.Where(o => o.IsClosed == true); vm.OpenOrdersCount = openOrders.Count(); vm.OpenNotPayedOrdersCount = notpayedOrders.Count(); vm.OpenSendOrdersCount = sendOrders.Count(); vm.ClosedOrdersCount = closedOrders.Count(); return(View(vm)); }
public ActionResult LinkAllUsersInCourseToAnother(int?CourseID, string SearchString) { if (!CourseID.HasValue || !ASS.CourseExist(CourseID)) { throw new Exception(); } var Courses = AS.GetAllUsersAndCourses().Courses; var Users = AS.UsersInCourse(CourseID.Value).Users; var ViewModel = new AdminHomeViewModel() { Courses = Courses, Users = Users, CourseName = AS.GetCourseByID(CourseID.Value).Name }; return(View(ViewModel)); }
// GET: Admin/Home public ActionResult Index() { AdminHomeViewModel model = new AdminHomeViewModel(); model.ServerMachineName = HttpContext.Server.MachineName; model.ServerIp = HttpContext.Request.ServerVariables["LOCAL_ADDR"]; model.ServerPort = HttpContext.Request.ServerVariables["SERVER_PORT"]; model.ServerSystem = Environment.OSVersion.ToString(); model.ServerSoftware = HttpContext.Request.ServerVariables["SERVER_SOFTWARE"]; model.ServerName = HttpContext.Request.ServerVariables["SERVER_NAME"]; model.FrameworkVersion = Environment.Version.Major + "." + Environment.Version.Minor + "." + Environment.Version.Build + "." + Environment.Version.Revision; model.CpuType = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER"); model.CpuCount = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"); model.ClientIp = HttpContext.Request.UserHostAddress; model.UserAgent = HttpContext.Request.ServerVariables["HTTP_USER_AGENT"]; model.Browser = HttpContext.Request.Browser.Browser + " " + HttpContext.Request.Browser.Version; return(View(model)); }
// GET: Administration/Home public async Task <ActionResult> Index(AdminHomeViewModel model) { Guard.WhenArgument(model, nameof(model)).IsNull().Throw(); var apporvedDiscussions = this.discussionsService.GetAllApprovedDiscussions(); var discussionsForApproval = this.discussionsService.GetAllDiscussionsForApproval(); var approvedBooks = this.booksService.GetAllApprovedBooks(); var booksForApproval = this.booksService.GetAllBooksForApproval(); var authors = this.authorService.GetAuthorsWithDeleted(); var comments = this.commentsService.GetAllComments(); var allUsers = this.usersService.GetAllUsers() .OrderBy(d => d.UserName) .ToList(); var users = new List <User>(); var administrators = new List <User>(); foreach (var user in allUsers) { if (await this.UserManager.IsInRoleAsync(user.Id, "User")) { users.Add(user); } else { administrators.Add(user); } } model.ApprovedDiscussionsCount = apporvedDiscussions.Count(); model.DiscussionsForApprovalCount = discussionsForApproval.Count(); model.ApprovedBooksCount = approvedBooks.Count(); model.BooksForApprovalCount = booksForApproval.Count(); model.AuthorsCount = authors.Count(); model.CommentsCount = comments.Count(); model.AdministratorsCount = administrators.Count(); model.UsersCount = users.Count(); return(this.View(model)); }
public IActionResult Index() { var model = new AdminHomeViewModel(); foreach (var identityUser in userManager.Users) { model.Users.Add(new UserViewModel { UserId = identityUser.Id, UserName = identityUser.UserName, Email = identityUser.Email }); } foreach (var apiResource in configurationService.ApiResources) { model.ApiResources.Add(new ApiResourceViewModel { Id = apiResource.Id, Name = apiResource.Name, DisplayName = apiResource.DisplayName, Description = apiResource.Description }); } foreach (var client in configurationService.Clients.Where(c => c.Enabled == true)) { model.Clients.Add(new ClientViewModel { Id = client.Id, ClientId = client.ClientId, Name = client.ClientName, Description = client.Description }); } return(View(model)); }
public ActionResult Index() { try { var model = (TblUser)Session["UserSession"]; if (model.RoleId == 1) { return(View()); } if (model.RoleId == 2) { AdminHomeViewModel adminHomeViewModel = new AdminHomeViewModel(); adminHomeViewModel.lstActivities = hm.GetAllAdminActivities(model.TenantId); adminHomeViewModel.allCounts = hm.GetAllAdminHomeCounts(model.TenantId); return(View("AdminHome", adminHomeViewModel)); } if (model.RoleId == 3) { HomeViewModel homeViewModel = new HomeViewModel(); homeViewModel.lstActivities = hm.GetAllLearnerActivities(model.TenantId, model.UserId, "Total"); homeViewModel.TotalCount = homeViewModel.lstActivities.Count; homeViewModel.CompletedCount = homeViewModel.lstActivities.Count(p => p.ActivityStatus == "Completed"); homeViewModel.InProgressCount = homeViewModel.lstActivities.Count(p => p.ActivityStatus == "InProgress"); homeViewModel.NotStartedCount = homeViewModel.lstActivities.Count(p => p.ActivityStatus == "Not Started"); var forum = fm.GetForumByForumType(model.TenantId); if (forum != null && forum.Count > 0) { homeViewModel.announcement = forum[0]; } return(View("LearnerHome", homeViewModel)); } } catch (Exception ex) { newException.AddException(ex); } return(RedirectToAction("Index", "Login")); }
//public ActionResult AllRentItems(AdminHomeViewModel model,int? id) //{ // id = id == null ? 0 : id - 1; // if (model == null) // { // model = (AdminHomeViewModel)TempData["model"]; // } // if (TempData.ContainsKey("model")) // { // TempData.Remove("model"); // TempData.Add("model", model); // } // else // { // TempData.Add("model", model); // } // var users = this.rentItemService.All(model.IsItemDeleted, model.RentItemFilter, (int)id); // return View(users); //} public ActionResult SearchUser(AdminHomeViewModel model, int?page) { page = page == null ? 0 : page - 1; if (model == null) { model = (AdminHomeViewModel)TempData["model"]; } if (TempData.ContainsKey("model")) { TempData.Remove("model"); TempData.Add("model", model); } else { TempData.Add("model", model); } var users = this.userService.All(model.IsUserDeleted, model.UserFilter); ViewBag.TotalPages = this.TotalPages(users.Count()); users.RemoveRange(0, (int)page * NoleggioConstants.PagingSize); return(View("Users", users.Take(NoleggioConstants.PagingSize).ToList())); }
/// <summary> /// Returns all users that are in the selected Course /// </summary> public AdminHomeViewModel UsersInCourse(int CourseID) { //Select all users from database with the given courseID var UsersInCourse = (from Application in _db.Users join C in _db.UserCourse on Application.UserName equals C.UserName where C.CourseID == CourseID select new UserViewModel() { UserName = Application.UserName, ID = Application.Id, }).ToList(); foreach (var User in UsersInCourse) { User.Role = Ident.GetUserRole(User.ID); } var ViewModel = new AdminHomeViewModel() { Users = UsersInCourse, CourseID = CourseID, CourseName = GetCourseByID(CourseID).Name }; return(ViewModel); }
public async Task <IActionResult> AdminHome() { var admin = await _context.ApplicationUsers .Include(u => u.UserType) .Where(u => u.UserTypeId == 1) .ToListAsync(); var reps = await _context.ApplicationUsers .Include(u => u.UserType) .Where(u => u.UserTypeId == 2) .ToListAsync(); var clientPages = await _context.ClientPages .ToListAsync(); var viewModel = new AdminHomeViewModel() { ClientPages = clientPages, Reps = reps, Admins = admin }; return(View(viewModel)); }
// GET: Admin public ActionResult Index() { var AdminViewModel = new AdminHomeViewModel(_repository); return(View(AdminViewModel)); }
public IActionResult Index() { try { id = (int)HttpContext.Session.GetInt32("id"); adsoyad = HttpContext.Session.GetString("adsoyad"); email = HttpContext.Session.GetString("email"); fotourl = HttpContext.Session.GetString("fotourl"); rolid = (int)HttpContext.Session.GetInt32("rolid"); } catch (Exception) { if (id == null || adsoyad == null || email == null || fotourl == null || rolid == null) { return(RedirectToAction("index", "AdminGiris")); } } var makaleler = _makaleServis.MakaleleriGetir(); var kategoriler = _kategoriServis.KategorileriGetir(); var maxOkunma = makaleler.Max(x => x.MakaleOkunmaSayisi); var makale = makaleler.First(x => x.MakaleOkunmaSayisi == maxOkunma); var grupKat = (from mak in makaleler orderby mak.KategoriId group mak by mak.KategoriId into kat select new { kat = kat.Key, makaleSayisi = kat.Count() }); int enbkatid = 0; int ilkatid = 0; int sonid = 0; int maksaykat = 0; foreach (var i in grupKat) { ilkatid = i.makaleSayisi; if (ilkatid > sonid) { sonid = ilkatid; enbkatid = i.kat; maksaykat = i.makaleSayisi; } } var kategori = _kategoriServis.KategoriGetir(enbkatid); var grupKul = (from mak in makaleler orderby mak.KullaniciId group mak by mak.KullaniciId into kul select new { kul = kul.Key, makaleSayisi = kul.Count() }); //var maxKul = ent.makaleler.select(i.kullaniciid).max(); int enbID = 0; int ilkd = 0; int sond = 0; int maksay = 0; foreach (var i in grupKul) { ilkd = i.makaleSayisi; if (ilkd > sond) { sond = ilkd; enbID = i.kul; maksay = i.makaleSayisi; } } var enbuyukId = enbID; var kullanici = _kullaniciServis.KullaniciGetir(enbuyukId); AdminHomeViewModel model = new AdminHomeViewModel(); model.Kullanici = kullanici; model.MakSayisi = maksay; model.Makale = makale; model.Kategori = kategori; model.KatMakaleSayisi = maksaykat; //model.Kategori = kategori; return(View(model)); }
public AdminHome() { InitializeComponent(); BindingContext = new AdminHomeViewModel(); }