public DataResult <List <DtProduct> > GetProductListByFollowingUser(string userId) { var user = _userDal.Get(x => x.Id == userId).FirstOrDefault(); var result = _productDal.Get(x => x.FollowerList.Contains(userId)).ToList(); return(new SuccessDataResult <List <DtProduct> >(result, "Successfull")); }
public IDataResult <DtUser> CreateUser(CreateUserRequest request) { if (_userDal.Get(x => x.Email == request.Email).FirstOrDefault() != null) { return(new ErrorDataResult <DtUser>(MessageConstants.ThisEmailIsUsingAlready)); } var user = new DtUser(); user.BirthDate = request.BirthDate; user.DeviceId = request.DeviceId; user.Email = request.Email; user.Firstname = request.Firstname; user.IsActive = false; user.IsApproved = false; user.IsTransferred = false; user.Lastname = request.Lastname; user.RegisterDate = DateTime.Now; var decryptedClientPassword = Encryption.Decrypt(request.Password, EncryptionConstants.ClientEncryptionKey); user.Password = Encryption.Encrypt(decryptedClientPassword, EncryptionConstants.ServerEncryptionKey); return(new SuccessDataResult <DtUser>(_userDal.AddAsync(user).Result)); }