Ejemplo n.º 1
0
        public void UpdatePassword(EditUserPasswordViewModel uvm)
        {
            var config = new MapperConfiguration(cfg => { cfg.CreateMap <EditUserPasswordViewModel, User>(); cfg.IgnoreUnmapped(); });

            IMapper mapper = config.CreateMapper();

            User u = mapper.Map <EditUserPasswordViewModel, User>(uvm);

            u.PasswordHash = SHA256Generator.GenerateHash(uvm.Password);

            ur.UpdatePassword(u);
        }
Ejemplo n.º 2
0
        public int InsertUser(RegisterViewModel uvm)
        {
            var config = new MapperConfiguration(cfg => { cfg.CreateMap <RegisterViewModel, User>(); cfg.IgnoreUnmapped(); });

            IMapper mapper = config.CreateMapper();

            User u = mapper.Map <RegisterViewModel, User>(uvm);

            u.PasswordHash = SHA256Generator.GenerateHash(uvm.Password);

            ur.InsertUser(u);

            int uid = ur.GetLatestUserID();

            return(uid);
        }
Ejemplo n.º 3
0
        public UserViewModel GetUsersByEmailAndPasswords(string Email, string Password)
        {
            User u = ur.GetUsersByEmailAndPasswords(Email, SHA256Generator.GenerateHash(Password)).FirstOrDefault();

            UserViewModel uvm = null;

            if (u != null)
            {
                var config = new MapperConfiguration(cfg => { cfg.CreateMap <User, UserViewModel>(); cfg.IgnoreUnmapped(); });

                IMapper mapper = config.CreateMapper();

                uvm = mapper.Map <User, UserViewModel>(u);

                return(uvm);
            }
            return(uvm);
        }