public bool UpdateUser(int userId, beUser userEntity) { var success = false; if (userEntity != null) { using (var scope = new TransactionScope()) { var user = _unitOfWork.UserRepository.GetById(userId); if (user != null) { user.FirstName = userEntity.FirstName; user.LastName = userEntity.LastName; user.Email = userEntity.Email; _unitOfWork.UserRepository.Update(user); _unitOfWork.Save(); scope.Complete(); success = true; } } } return(success); }
public int CreateUser(beUser userEntity) { using (var scope = new TransactionScope()) { var user = new User { FirstName = userEntity.FirstName, LastName = userEntity.LastName, Email = userEntity.Email, Password = userEntity.Password, PasswordSalt = userEntity.PasswordSalt, CurrencyId = userEntity.CurrencyId, PrimaryNumber = userEntity.PrimaryNumber, UserName = userEntity.UserName, IsActive = true, CreatedBy = userEntity.CreatedBy, CreatedOn = DateTime.Now, ModifiedBy = userEntity.ModifiedBy, ModifiedOn = userEntity.ModifiedOn, }; _unitOfWork.UserRepository.Insert(user); _unitOfWork.Save(); scope.Complete(); return(user.Id); } }