Ejemplo n.º 1
0
        public async Task <IActionResult> AddAdministrator(DashboardBaseModel model)
        {
            if (this.ModelState.IsValid)
            {
                await this.dashboardService.AddAdministrator(model.AddRemoveAdminInputModel.Username);

                this.TempData["Success"] = string.Format(
                    MessageConstants.SuccessfullyAddAdministrator,
                    model.AddRemoveAdminInputModel.Username.ToUpper(),
                    Constants.AdministratorRole.ToUpper());
                return(this.RedirectToAction("Index", "Dashboard"));
            }
            else
            {
                this.TempData["Error"] = MessageConstants.InvalidInputModel;
                return(this.RedirectToAction("Index", "Dashboard", model));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            var viewModel = new DashboardViewModel
            {
                AllUsers          = this.dashboardService.GetAllUsers(),
                AllAdminsCount    = await this.dashboardService.GetAllAdminsCount(),
                AllUsersCount     = await this.dashboardService.GetAllUsersCount(),
                AllAdminsNames    = await this.dashboardService.GetAllAdminsNames(),
                AllNotAdminsNames = await this.dashboardService.GetAllNotAdminsNames(),
                AllJobPositions   = await this.dashboardService.GetAllJobPositionsCount(),
                AllJobCandidates  = await this.dashboardService.GetAllJobCandidatesCount(),
            };

            var model = new DashboardBaseModel
            {
                DashboardViewModel       = viewModel,
                AddRemoveAdminInputModel = new AddRemoveAdminInputModel(),
            };

            return(this.View(model));
        }