Example #1
0
        public IActionResult EditUser(int id)
        {
            User u = dc.getAllUsers().FirstOrDefault(u => u.id == id);
            UserDashboardRegulatedViewModel model = new UserDashboardRegulatedViewModel(u);

            return(View(model));
        }
Example #2
0
        public IActionResult EditUser(UserDashboardRegulatedViewModel model)
        {
            if (ModelState.IsValid)
            {
                User u = new User(model);
                dc.updateUser(u);

                return(Redirect("/Home/ManageUsers"));
            }

            return(View(model));
        }
Example #3
0
        public IActionResult CreateUser()
        {
            if (loggedUser == null)
            {
                return(NotFound());
            }
            if (loggedUser.isAdmin == false)
            {
                return(NotFound());
            }

            UserDashboardRegulatedViewModel model = new UserDashboardRegulatedViewModel();

            return(View(model));
        }
        public IActionResult EditUser(int id)
        {
            if (HomeController.loggedUser is null)
            {
                return(NotFound());
            }
            if (HomeController.loggedUser.isAdmin == false)
            {
                return(NotFound());
            }

            User u = ds.getFirstEntry <User>(u => u.id == id);
            UserDashboardRegulatedViewModel model = new UserDashboardRegulatedViewModel(u);

            return(View(model));
        }
Example #5
0
 public User(UserDashboardRegulatedViewModel model)
 {
     this.id = model.id;
     this.username = model.username;
     this.password = model.password;
     this.isAdmin = model.isAdmin;
     this.EGN = model.EGN;
     this.isActive = model.isActive;
     this.firstName = model.firstName;
     this.secondName = model.secondName;
     this.thirdName = model.thirdName;
     this.EGN = model.EGN;
     this.phoneNumber = model.phoneNumber;
     this.recruitmentDate = model.recruitmentDate;
     this.dismisalDate = model.dismisalDate;
     this.isAdmin = model.isAdmin;
 }
Example #6
0
        public IActionResult CreateUser(UserDashboardRegulatedViewModel model)
        {
            if (loggedUser == null)
            {
                return(NotFound());
            }
            if (loggedUser.isAdmin == false)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                User u = new User(model);
                dc.addUser(u);

                return(RedirectToAction(nameof(ManageUsers)));
            }

            return(View(model));
        }
        public IActionResult EditUser(UserDashboardRegulatedViewModel model)
        {
            if (HomeController.loggedUser is null)
            {
                return(NotFound());
            }
            if (HomeController.loggedUser.isAdmin == false)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                User u = new User(model);
                ds.updateEntry(u);

                return(Redirect("/Dashboard/ManageUsers"));
            }

            return(View(model));
        }