Exemple #1
0
        public UserProvider(string name, RepositoryHandler <User> usersRepositoryHandler,
                            RepositoryHandler <Role> rolesRepositoryHandler)
        {
            _usersRepositoryHandler = usersRepositoryHandler;
            _rolesRepositoryHandler = rolesRepositoryHandler;

            if (name != null)
            {
                _user = _usersRepositoryHandler.GetAll(x => x.UserName == name).First();
            }
        }
        public User Register(RegisterModel registerModel)
        {
            if (_usersRepository.GetAll(user => user.UserName == registerModel.Login).Count() == 0)
            {
                _usersRepository.Add(new User
                {
                    FirstName  = registerModel.FirstName,
                    LastName   = registerModel.LastName,
                    Patronymic = registerModel.Patronymic,
                    UserName   = registerModel.Login,
                    PositionId = registerModel.PositionId,
                    Password   = registerModel.Password,
                    Email      = registerModel.Email,
                    RoleId     = 2 //user
                });

                return(_usersRepository.GetAll(user => user.UserName == registerModel.Login).First());
            }
            return(null);
        }
        public UserProvider(string name, RepositoryHandler<User> usersRepositoryHandler,
            RepositoryHandler<Role> rolesRepositoryHandler)
        {
            _usersRepositoryHandler = usersRepositoryHandler;
            _rolesRepositoryHandler = rolesRepositoryHandler;

            if (name != null)
            {
                _user = _usersRepositoryHandler.GetAll(x => x.UserName == name).First();
            }
        }
 public ActionResult Users()
 {
     @ViewBag.Positions = _positionsHandler.GetAll(x => true);
     @ViewBag.Roles     = RolesHandler.GetAll(x => true);
     return(View("Index/Users", UsersHandler.GetAll(x => true)));
 }
 public ActionResult DocumentTypes()
 {
     return(View("Index/DocumentTypes", DocumentTypesHandler.GetAll(x => true)));
 }
        public ActionResult DocumentTemplates()
        {
            var templates = TemplatesHandler.GetAll(x => true);

            return(View("Index/DocumentTemplates", templates));
        }