public IActionResult Index()
        {
            ViewData["Create"] = RolesForMenu.GetMenu(User.Identity.Name, "Model", "Create");
            ViewData["Edit"]   = RolesForMenu.GetMenu(User.Identity.Name, "Model", "Edit");
            ViewData["Delete"] = RolesForMenu.GetMenu(User.Identity.Name, "Model", "Delete");

            return(View(_context.employeeVMs.ToList()));
        }
예제 #2
0
        public async Task <IActionResult> Index()
        {
            ViewData["Create"] = RolesForMenu.GetMenu(User.Identity.Name, "Country", "Create");
            ViewData["Edit"]   = RolesForMenu.GetMenu(User.Identity.Name, "Country", "Edit");
            ViewData["Delete"] = RolesForMenu.GetMenu(User.Identity.Name, "Country", "Delete");

            return(View(await _context.countries.Include(e => e.Cities).ToListAsync()));
        }
예제 #3
0
        public ActionResult Index(string SearchString, string CurrentFilter, string sortOrder, int?Page)
        {
            ViewData["Create"] = RolesForMenu.GetMenu(User.Identity.Name, "Player", "Create");
            ViewData["Edit"]   = RolesForMenu.GetMenu(User.Identity.Name, "Player", "Edit");
            ViewData["Delete"] = RolesForMenu.GetMenu(User.Identity.Name, "Player", "Delete");
            var applicationDbContext = _context.players.Include(c => c.Name);

            ViewBag.SortNameParam = string.IsNullOrEmpty(sortOrder) ? "name_des" : "";
            ViewBag.Salary        = string.IsNullOrEmpty(sortOrder) ? "salary_des" : "";
            if (SearchString != null)
            {
                Page = 1;
            }
            else
            {
                SearchString = CurrentFilter;
            }
            ViewBag.CurrentFilter = SearchString;


            List <PlayerListViewModel> playerList = _context.players.Select(p => new PlayerListViewModel
            {
                PlayerID  = p.PlayerID,
                Name      = p.Name,
                DoB       = p.DoB,
                Team      = p.Team,
                Email     = p.Email,
                Phone     = p.Phone,
                Salary    = p.Salary,
                ImageName = p.ImageName,
                ImageUrl  = p.ImageUrl,
                GradeID   = p.GradeID,
                GradeName = p.Grade.GradeName,
            }).ToList();

            if (!string.IsNullOrEmpty(SearchString))
            {
                playerList = playerList.Where(n => n.Name.ToUpper().Contains(SearchString.ToUpper())).ToList();
            }
            switch (sortOrder)
            {
            case "name_des":
                playerList = playerList.OrderByDescending(n => n.Name).ToList();
                break;

            case "salary_des":
                playerList = playerList.OrderByDescending(n => n.Salary).ToList();
                break;

            default:
                playerList = playerList.OrderBy(n => n.Name).ToList();
                break;
            }
            int PageSize   = 100;
            int PageNumber = (Page ?? 1);

            return(View("Index", playerList.ToPagedList(PageNumber, PageSize)));
        }
예제 #4
0
        public async Task <ActionResult> Index()
        {
            ViewData["Create"] = RolesForMenu.GetMenu(User.Identity.Name, "Categories", "Create");
            ViewData["Edit"]   = RolesForMenu.GetMenu(User.Identity.Name, "Categories", "Edit");
            ViewData["Delete"] = RolesForMenu.GetMenu(User.Identity.Name, "Categories", "Delete");

            ViewBag.CategoryID = new SelectList(_context.Categories, "ID", "Name");
            return(View(await _context.Categories.ToListAsync()));
        }
        public async Task <IActionResult> Index()
        {
            ViewData["Create"] = RolesForMenu.GetMenu(User.Identity.Name, "Product", "Create");
            ViewData["Edit"]   = RolesForMenu.GetMenu(User.Identity.Name, "Product", "Edit");
            ViewData["Delete"] = RolesForMenu.GetMenu(User.Identity.Name, "Product", "Delete");

            var applicationDbContext = _context.Products.Include(p => p.Supplier);

            return(View(await applicationDbContext.ToListAsync()));
        }
예제 #6
0
        public async Task <IActionResult> Index()
        {
            ViewData["Create"] = RolesForMenu.GetMenu(User.Identity.Name, "Order", "Create");
            ViewData["Edit"]   = RolesForMenu.GetMenu(User.Identity.Name, "Order", "Edit");
            ViewData["Delete"] = RolesForMenu.GetMenu(User.Identity.Name, "Order", "Delete");

            var applicationDbContext = _context.Orders.Include(o => o.Customer);

            return(View(await applicationDbContext.ToListAsync()));
        }
        public async Task <IActionResult> Index()
        {
            ViewData["Create"] = RolesForMenu.GetMenu(User.Identity.Name, "Customer", "Create");
            ViewData["Edit"]   = RolesForMenu.GetMenu(User.Identity.Name, "Customer", "Edit");
            ViewData["Delete"] = RolesForMenu.GetMenu(User.Identity.Name, "Customer", "Delete");

            var customers = _context.Customers.Include(c => c.City).ThenInclude(e => e.Country);

            return(View(await customers.ToListAsync()));
        }
예제 #8
0
        public async Task <IActionResult> Index()
        {
            ViewData["Create"] = RolesForMenu.GetMenu(User.Identity.Name, "City", "Create");
            ViewData["Edit"]   = RolesForMenu.GetMenu(User.Identity.Name, "City", "Edit");
            ViewData["Delete"] = RolesForMenu.GetMenu(User.Identity.Name, "City", "Delete");

            var applicationDbContext = _context.Cities.Include(c => c.Country);

            return(View(await applicationDbContext.ToListAsync()));
        }
예제 #9
0
        public async Task <IActionResult> Index(string filter, int page = 1, string sortExpression = "EmployeeName")
        {
            ViewData["Create"] = RolesForMenu.GetMenu(User.Identity.Name, "ViewModel", "Create");
            ViewData["Edit"]   = RolesForMenu.GetMenu(User.Identity.Name, "ViewModel", "Edit");
            ViewData["Delete"] = RolesForMenu.GetMenu(User.Identity.Name, "ViewModel", "Delete");
            //return View(await _context.EmployeeCreateViewModel.ToListAsync());
            var qry = _context.tblEmployees.AsNoTracking()
                      .AsQueryable();

            if (!string.IsNullOrWhiteSpace(filter))
            {
                qry = qry.Where(p => p.EmployeeName.Contains(filter));
            }
            var model = await PagingList.CreateAsync(qry, 2, page, sortExpression, "EmployeeName");

            model.RouteValue = new RouteValueDictionary
            {
                { "filter", filter }
            };
            return(View(model));
        }
예제 #10
0
        public ActionResult Index()
        {
            ViewData["AddNewEmployee"] = RolesForMenu.GetMenu(User.Identity.Name, "AjaxCrud", "AddNewEmployee");

            return(View(_context.employeeAjaxes.ToList()));
        }