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);
        }
        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);
        }
        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);
        }