Example #1
0
        public void UpdateUserPassword(EditUserPasswordViewModel uvm)
        {
            var     config = new MapperConfiguration(cfg => { cfg.CreateMap <EditUserPasswordViewModel, Users>(); cfg.IgnoreUnmapped(); });
            IMapper mapper = config.CreateMapper();
            Users   u      = mapper.Map <EditUserPasswordViewModel, Users>(uvm);

            u.PasswordHash = SHA256HashGenerator.GenerateHash(uvm.Password);
            ur.UpdateUserPassword(u);
        }
Example #2
0
        public int InsertUser(RegisterUserViewModel uvm)
        {
            var     config = new MapperConfiguration(cfg => { cfg.CreateMap <RegisterUserViewModel, Users>(); cfg.IgnoreUnmapped(); });
            IMapper mapper = config.CreateMapper();
            Users   u      = mapper.Map <RegisterUserViewModel, Users>(uvm);

            u.PasswordHash = SHA256HashGenerator.GenerateHash(uvm.Password);
            ur.InsertUser(u);
            int uid = ur.GetLatestUserID();

            return(uid);
        }
Example #3
0
        public UserViewModel GetUsersByEmailAndPassword(string Email, string Password)
        {
            Users         u   = ur.GetUsersByEmailAndPassword(Email, SHA256HashGenerator.GenerateHash(Password)).FirstOrDefault();
            UserViewModel uvm = null;

            if (u != null)
            {
                var     config = new MapperConfiguration(cfg => { cfg.CreateMap <Users, UserViewModel>(); cfg.IgnoreUnmapped(); });
                IMapper mapper = config.CreateMapper();
                uvm = mapper.Map <Users, UserViewModel>(u);
            }
            return(uvm);
        }