public int Insert(User user, int roleId) { int success = 0; ITableRelationService tableRelationService=new TableRelationService(); using(TransactionScope ts=new TransactionScope()) { success = Insert(user); user.UserId = success; if(success>0) { success = tableRelationService.InsertUser_Role(user.UserId, roleId); } if(success>0) { ts.Complete(); } } return success; }
public int Insert(User user, int roleId) { int success = 0; ITableRelationService tableRelationService = new TableRelationService(); using (TransactionScope ts = new TransactionScope()) { success = Insert(user); user.UserId = success; if (success > 0) { success = tableRelationService.InsertUser_Role(user.UserId, roleId); } if (success > 0) { ts.Complete(); } } return(success); }