public void Create(User entity) { var hash = new Hashhing(); entity.Password = hash.HashPassword(entity.Password); _unitOfWork.GetRepository <User>().Insert(entity); _unitOfWork.Commit(); }
public bool Login(User user) { var savedPasswordHash = _unitOfWork.GetRepository <User>().GetSingle(u => u.Email == user.Email).Password; var hash = new Hashhing(); if (hash.VerifyHashPassword(savedPasswordHash, user.Password)) { user = _unitOfWork.GetRepository <User>().GetSingle(x => x.Email == user.Email); user.Role = _unitOfWork.GetRepository <Role>().GetSingle(x => x.RoleId == user.RoleId); return(true); } return(false); }