public void UpdateUserPassword(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 = SHA256HashGenerator.GenerateHash(uvm.Password);
            ur.UpdateUserPassword(u);
        }
        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 = SHA256HashGenerator.GenerateHash(uvm.Password);
            ur.InsertUser(u);
            int uid = ur.GetLatestUserId();

            return(uid);
        }
        public UserViewModel GetUsersByEmailAndPassword(string Email, string Password)
        {
            User          u   = ur.GetUsersByEmailAndPassword(Email, SHA256HashGenerator.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);
        }