// GET: DepartmentDelegation
        public ActionResult Index()
        {
            var viewModel = new DepartmentDelegationViewModel()
            {
                DepartmentDelegations = departmentDelegationService.GetAll()
            };

            return(View(viewModel));
        }
        public ActionResult Edit(string id)
        {
            var dd = departmentDelegationService.Get(id);
            var departmentDelegation = new DepartmentDelegationViewModel()
            {
                StartDate = dd.StartDate,
                EndDate   = dd.EndDate,
                Status    = dd.Status,
                UserId    = User.Identity.Name
            };

            return(View("DepartmentDelegationForm", departmentDelegation));
        }
コード例 #3
0
        public ActionResult DelegationActiveList()
        {
            var departmentId         = User.Identity.GetDepartmentId();
            var UsersContext         = new ApplicationDbContext();
            var departmentDelegation = new DepartmentDelegationViewModel()
            {
                Users = UsersContext.Users
                        .Where(x => x.DepartmentId == departmentId)
                        .Where(x => x.Roles.Any(r => r.RoleId == UserRoles.Employee || r.RoleId == UserRoles.Representative))
                        .ToList(),
                DepartmentDelegations = departmentDelegationService.GetAllByDepartmentId(departmentId).Where(x => x.Status == CustomStatus.isActive),
                DepartmentId          = departmentId,
                Department            = departmentService.Get(departmentId)
            };

            ViewBag.dD = "Showing Results for Active List";
            return(View("ManageDelegation", departmentDelegation));
        }
コード例 #4
0
        public ActionResult Delegation()
        {
            var departmentId         = User.Identity.GetDepartmentId();
            var UsersContext         = new ApplicationDbContext();
            var departmentDelegation = new DepartmentDelegationViewModel()
            {
                //users = get the department id of currently logged in user
                //select all users with that id
                Users = UsersContext.Users
                        .Where(x => x.DepartmentId == departmentId)
                        .Where(x => x.Roles.Any(r => r.RoleId == UserRoles.Employee || r.RoleId == UserRoles.Representative))
                        .ToList(),
                DepartmentDelegations = departmentDelegationService.GetAllByDepartmentId(departmentId),
                DepartmentId          = departmentId,
                Department            = departmentService.Get(departmentId)
            };

            return(View("ManageDelegation", departmentDelegation));
        }
        public ActionResult Create()
        {
            var departmentDelegation = new DepartmentDelegationViewModel();

            return(View("DepartmentDelegationForm", departmentDelegation));
        }