Ejemplo n.º 1
0
 /// <summary>
 /// Creates a product
 /// </summary>
 /// <param name="productEntity"></param>
 /// <returns></returns>
 public int CreateUser(UserEntity userEntity)
 {
     using (var scope = new TransactionScope())
     {
         var user = new User
         {
             Name = userEntity.Name
         };
         _unitOfWork.UserRepository.Insert(user);
         _unitOfWork.Save();
         scope.Complete();
         return user.ID;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Updates a product
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="productEntity"></param>
 /// <returns></returns>
 public bool UpdateUser(int userId, UserEntity userEntity)
 {
     var success = false;
     if (userEntity != null)
     {
         using (var scope = new TransactionScope())
         {
             var user = _unitOfWork.UserRepository.GetByID(userId);
             if (user != null)
             {
                 user.Name = userEntity.Name;
                 _unitOfWork.UserRepository.Update(user);
                 _unitOfWork.Save();
                 //scope.Complete();
                 success = true;
             }
         }
     }
     return success;
 }